1# This workflow updates the list of deleted files based on the recent changes and creates a pull request. 2# It compares the current master with the data/deleted.files file and cleans the file from any re-introduced files. 3# It compares the current master with the stable branch and adds all deleted files to the data/deleted.files file 4# unless they are already listed there or are excluded from the release archives (export-ignore in .gitattributes). 5# Any additions are made to the top of the list with a single trailing line before the first "# removed on" line. 6# Finally, the list of newly removed entries receives a header "# removed on $(date -I)" with the current ISO date. 7 8name: "Update deleted files" 9on: 10 push: 11 branches: 12 - master 13 14concurrency: 15 group: ${{ github.workflow }}-${{ github.ref }} 16 cancel-in-progress: true 17 18jobs: 19 update: 20 name: Update deleted files 21 runs-on: ubuntu-latest 22 steps: 23 - name: Checkout 24 uses: actions/checkout@v4 25 with: 26 fetch-depth: 0 27 28 - name: Cleaning list from re-introduced files 29 run: | 30 for E in $(git ls-tree -r master --name-only); do 31 if (git check-attr export-ignore "$E" | grep -q "export-ignore: set"); then 32 continue 33 fi 34 grep -v "^$E$" data/deleted.files > data/deleted.files.tmp && mv data/deleted.files{.tmp,} 35 done 36 37 - name: Update list with deleted files 38 run: | 39 for F in $(git diff origin/stable..HEAD --summary | awk '/^ delete/ && $4 !~ /^(VERSION)/ {print $4}'); do 40 if (git check-attr export-ignore "$F" | grep -q "export-ignore: set"); then 41 continue 42 fi 43 if grep -q "^$F$" data/deleted.files; then 44 continue 45 fi 46 if ( ! test -f "data/deleted.files.tmp"); then 47 awk -v "input=# newly removed" '/# removed on/ && !found {print input; found=1} 1' data/deleted.files > data/deleted.files.tmp && cp data/deleted.files{.tmp,} 48 fi 49 awk -v "input=$F" '/# removed on/ && !found {print input; found=1} 1' data/deleted.files > data/deleted.files.tmp && cp data/deleted.files{.tmp,} 50 done 51 if (test -f "data/deleted.files.tmp"); then 52 awk '/# removed on/ && !found {printf("\n"); found=1} 1' data/deleted.files > data/deleted.files.tmp && mv data/deleted.files{.tmp,} 53 sed -i "s/^# newly removed/# removed on $(date -I)/" data/deleted.files 54 fi 55 56 - name: Create Pull Request 57 uses: peter-evans/create-pull-request@v6 58 with: 59 commit-message: " Update deleted files" 60 title: " Update deleted files" 61 body: "This updates the list of deleted files based on the recent changes." 62 delete-branch: true 63 branch: "bot/deletedFiles" 64