forked from uyuni-project/sumaform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
26 additions
and
20 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,37 @@ | ||
name: mirror-update-warning | ||
name: Mirror update notification | ||
|
||
on: push | ||
on: | ||
pull_request_target: | ||
types: [opened, edited, synchronize, reopened, closed] | ||
# 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/[email protected] | ||
with: | ||
githubToken: ${{ secrets.GITHUB_TOKEN }} | ||
plaintext: true | ||
- name: RESULTS | ||
fetch-depth: 2 | ||
- name: Find modified images | ||
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' | ||
uses: peter-evans/commit-comment@v1 | ||
echo "DIFF<<EOF" >> $GITHUB_ENV | ||
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/' | uniq >> $GITHUB_ENV | ||
echo "EOF" >> $GITHUB_ENV | ||
- name: Comment on the pull request | ||
if: env.DIFF | ||
uses: peter-evans/create-or-update-comment@v2 | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
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 images: | ||
${{ env.DIFF }} | ||
Please consider updating the CI and BV mirror configurations accordingly. |