-
Notifications
You must be signed in to change notification settings - Fork 76
52 lines (47 loc) · 1.84 KB
/
snap-build-on-approval.yaml
File metadata and controls
52 lines (47 loc) · 1.84 KB
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
47
48
49
50
51
52
name: Validate snap builds when PR is approved
permissions:
contents: read
on:
pull_request_review:
types: [submitted]
# Allow manual trigger
workflow_dispatch:
jobs:
snapcraft_changes_required:
runs-on: ubuntu-latest
name: Check for changes in checkbox-snap and checkbox-core-snap dirs
outputs:
required_run: ${{ steps.check_diff.outputs.required_run }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- name: Use git diff to see if there are any changes in the snap directories
id: check_diff
run: |
DIFF_LENGTH=`git diff HEAD origin/main -- checkbox-snap checkbox-core-snap | wc -l`
if [[ $DIFF_LENGTH -eq 0 ]]
then
echo "No snap build validation required."
echo "required_run=false" >> $GITHUB_OUTPUT
else
echo "Snap build validation required!"
echo "required_run=true" >> $GITHUB_OUTPUT
fi
snap-cross-build-validation:
needs: snapcraft_changes_required
if: (github.event.review.state == 'approved' && true == fromJSON(needs.snapcraft_changes_required.outputs.required_run)) || github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/checkbox-daily-cross-builds.yaml
secrets:
SNAPCRAFT7_CREDS: ${{ secrets.SNAPCRAFT7_CREDS }}
with:
store_upload: false
snap-native-build-validation:
needs: snapcraft_changes_required
if: (github.event.review.state == 'approved' && true == fromJSON(needs.snapcraft_changes_required.outputs.required_run)) || github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/checkbox-daily-native-builds.yaml
secrets:
SNAPCRAFT7_CREDS: ${{ secrets.SNAPCRAFT7_CREDS }}
with:
store_upload: false