Skip to content

Check-For-Duplicate-Image-Names #7

Check-For-Duplicate-Image-Names

Check-For-Duplicate-Image-Names #7

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@v3
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@v3
# 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 }}
commit-message: Auto Rename Duplicate Images
title: Auto Rename Duplicate Images
body: Generated Automatically via GitHub Actions
base: main
branch: auto-rename-duplicate-images
delete-branch: true