-
Notifications
You must be signed in to change notification settings - Fork 41
40 lines (35 loc) · 1.59 KB
/
deleted-files.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Deleted files
on:
pull_request:
branches:
master
jobs:
list-deleted-files:
runs-on: ubuntu-latest
name: Detect deleted files
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get changed docs md files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: docs/**/*.md
- name: Format list of deleted files
id: format-output
env:
ORIGINAL_DELETED: '${{ steps.changed-files.outputs.deleted_files }}'
ORIGINAL_RENAMED: '${{ steps.changed-files.outputs.renamed_files }}'
run: |
echo "FORMATTED_DELETED=$(echo $ORIGINAL_DELETED | sed 's/ /`<br>`/g')" >> $GITHUB_OUTPUT
echo "FORMATTED_RENAMED=$(echo $ORIGINAL_RENAMED | sed 's/ /`<br>`/g')" >> $GITHUB_OUTPUT
- name: Comment PR if there are deleted files
if: steps.changed-files.outputs.any_deleted == 'true'
uses: thollander/actions-comment-pull-request@v2
with:
message: |
## Remember to add redirects
${{ steps.format-output.outputs.FORMATTED_DELETED != '' && format('This PR **deletes** one or more `md` files:<br>`{0}`<br>', steps.format-output.outputs.FORMATTED_DELETED) || '' }}
${{ steps.format-output.outputs.FORMATTED_RENAMED != '' && format('This PR **renames** one or more `md` files:<br>`{0}`<br>', steps.format-output.outputs.FORMATTED_RENAMED) || '' }}
Remember to append the appropriate redirects in `mkdocs.yml` under `plugins.redirects.redirect_maps`.
comment_tag: deleted-files-reminder