-
Notifications
You must be signed in to change notification settings - Fork 4
46 lines (42 loc) · 1.36 KB
/
rebuild-backupasaurus.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
41
42
43
44
45
46
name: Backup-a-saurus
on:
pull_request:
types: [ closed ]
jobs:
check-gpg-changed:
runs-on: ubuntu-latest
outputs:
gpg_modified: ${{ steps.modified_dirs.outputs.gpg_modified }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: check modified directories
id: modified_dirs
run: |
CMD="git diff --name-only HEAD^ HEAD"
echo "Modified files:"
$CMD
# Check if gpg dir has been modified
MODIFIED=$($CMD gpg)
if [[ -n "${MODIFIED}" ]]; then
echo "Trigger docker build"
echo "::set-output name=gpg_modified::true"
else
echo "::set-output name=gpg_modified::false"
fi
trigger-rebuild: #Triggers a rebuild of the backup a saurus
runs-on: ubuntu-latest
needs: check-gpg-changed
if: github.event.pull_request.merged == true && needs.check-gpg-changed.outputs.gpg_modified == 'true'
steps:
- name: Backup-a-saurus workflow
run: |
set -e
curl \
-X POST \
-H "Accept: application/vnd.github.+json" \
-H "Authorization: Bearer ${{secrets.SPRINGLOAD_PAT}}" \
https://api.github.com/repos/springload/backup-a-saurus/dispatches \
-d '{"event_type": "trigger-rebuild"}'