[pull] master from CivicActions:master #308
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update links and redirects for renamed files. | |
on: | |
pull_request: | |
env: | |
COMMIT_MESSAGE: Updating links after file move or rename | |
jobs: | |
manage-renames: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Update links from file rename changes and detect potential reminders | |
run: | | |
git fetch origin ${{ github.event.pull_request.base.ref }} | |
python .config/update_rename_links.py "origin/${{ github.event.pull_request.base.ref }}" "${{ github.event.pull_request.head.ref }}" "${GITHUB_ENV}" | |
if [ "$(git log -1 --format=%s)" == "${{ env.COMMIT_MESSAGE }}" ]; then echo "Loop detected"; exit; fi | |
- name: Autocommit changes, if there are any | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: ${{ env.COMMIT_MESSAGE }} | |
- name: Add PR reminder for potential renames | |
if: env.REMINDER == 'POTENTIAL_RENAME' | |
uses: mshick/add-pr-comment@v2 | |
with: | |
message: | | |
**Potential file move or rename - missing nav update / redirect** | |
- There appear to be added and removed files in this pull request, but [the mkdocs.yml nav](.config/mkdocs.yml) or [redirect.yml](.config/redirect.yml) have not been modified. | |
- If pages were moved or renamed as part of this edit, please edit [mkdocs.yml](.config/mkdocs.yml) to update the menu paths, edit [redirect.yml](.config/redirect.yml) to add redirects from the old to new locations. You may also need to update links to the file in other pages. | |
- If not, feel free to ignore this message. | |
- name: Add PR reminder for deletions | |
if: env.REMINDER == 'DELETION' | |
uses: mshick/add-pr-comment@v2 | |
with: | |
message: | | |
**Potential file deletion - missing nav update / redirect** | |
- There appear to be deleted files in this pull request, but [the mkdocs.yml nav](.config/mkdocs.yml) or [redirect.yml](.config/redirect.yml) have not been modified. | |
- If pages were deleted, please edit [mkdocs.yml](.config/mkdocs.yml) to remove the page from the menu, edit [redirect.yml](.config/redirect.yml) to add redirects (if there is a new location). You may also need to remove links to the file in other pages. | |
- If not, feel free to ignore this message. | |
- name: Add PR reminder for additions | |
if: env.REMINDER == 'ADDITION' | |
uses: mshick/add-pr-comment@v2 | |
with: | |
message: | | |
**Potential file addition - missing nav update** | |
- There appear to be new files added in this pull request, but [the mkdocs.yml nav](.config/mkdocs.yml) has not been modified. | |
- If pages were added, please edit [mkdocs.yml](.config/mkdocs.yml) to add the new page to the menu. | |
- If not, feel free to ignore this message. |