From ce12f2cbfa0b05343f1ec9b499df4f921988a268 Mon Sep 17 00:00:00 2001 From: Can Bulut Bayburt Date: Sun, 19 Nov 2023 16:55:29 +0100 Subject: [PATCH] [WIP] Update mirror-update-warning --- .github/workflows/mirror-update-warning.yml | 41 +++++++++++---------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/.github/workflows/mirror-update-warning.yml b/.github/workflows/mirror-update-warning.yml index fd4317468..a48c4bb90 100644 --- a/.github/workflows/mirror-update-warning.yml +++ b/.github/workflows/mirror-update-warning.yml @@ -1,31 +1,34 @@ -name: mirror-update-warning +name: Mirror update notification -on: push +on: + pull_request: +# branches: +# - master + paths: + - backend_modules/libvirt/base/main.tf jobs: Check-changed-files: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Get Changed Files - id: get_file_changes - uses: trilom/file-changes-action@v1.2.3 with: - githubToken: ${{ secrets.GITHUB_TOKEN }} - plaintext: true - - name: RESULTS + fetch-depth: 2 + - name: Get changed URLs run: | - for directory in ${{ steps.get_file_changes.outputs.files }} - do - if [ ${directory} == "backend_modules/libvirt/base/main.tf" ] - then - echo "IMAGES_CHANGED=true" >> $GITHUB_ENV - fi - done - - name: PR Comment - if: env.IMAGES_CHANGED == 'true' + DIFF=$(git diff -p -U0 --no-color --diff-filter=M -G"\{var\.mirror\}" \ + ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} \ + -- backend_modules/libvirt/base/main.tf | \ + grep "^[+-] " | sed 's/^[+-]\s*\([^ ]*\).*$/ - \1\n/' | uniq) + + echo "DIFF=$DIFF" >> $GITHUB_ENV + + - name: Comment on the pull request + if: env.DIFF uses: peter-evans/commit-comment@v1 with: body: | - Before merging this PR, keep in mind we must have updated CI and BV Mirror YAML files. - Thank you for your collaboration. + This pull request modifies the URLs of the following repositories. + Please consider updating the CI and BV mirror configurations accordingly. + + ${{ env.DIFF }}