Skip to content

Check-For-Duplicate-Image-Names #12

Check-For-Duplicate-Image-Names

Check-For-Duplicate-Image-Names #12

name: Check-For-Duplicate-Image-Names
on:
schedule:
- cron: "0 2 * * 5"
workflow_dispatch:
jobs:
check-duplicate-images:
runs-on: ubuntu-latest
permissions:
contents: write
repository-projects: read
pull-requests: write
steps:
# Step 1: Check out the source code of the pull request.
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
# Step 2: Set up the Node.js environment.
- uses: actions/setup-node@v4
# Step 3: Check and renaming duplicate images
- name: Rename Duplicate Images
uses: mathiasvr/command-output@v1
id: check_and_fix_duplicate_names
with:
run: |
cd scripts/rename-duplicate-images
node rename-duplicate-images.js
# Step 4: Create PR for the changes
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
committer: SSW-Rules-Bot <[email protected]>
author: SSW-Rules-Bot <[email protected]>
commit-message: Auto Rename Duplicate Images
title: Auto Rename Duplicate Images
body: |
Generated automatically via GitHub Actions.
This PR was created because an automated check found multiple images with the same name in SSW.Rules.Content and tried to rename them.
The goal is to prevent incorrect images from being displayed on rules, see detail at https://github.com/SSWConsulting/SSW.Rules.Content/wiki/GitHub-Action---Check-For-Duplicate-Image-Names
base: main
branch: auto-rename-duplicate-images
delete-branch: true