@@ -3,6 +3,7 @@ name: Check Certificates
3
3
4
4
# See: https://docs.github.com/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows
5
5
on :
6
+ create :
6
7
push :
7
8
paths :
8
9
- " .github/workflows/check-certificates.ya?ml"
20
21
EXPIRATION_WARNING_PERIOD : 30
21
22
22
23
jobs :
24
+ run-determination :
25
+ runs-on : ubuntu-latest
26
+ outputs :
27
+ result : ${{ steps.determination.outputs.result }}
28
+ permissions : {}
29
+ steps :
30
+ - name : Determine if the rest of the workflow should run
31
+ id : determination
32
+ run : |
33
+ RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
34
+ REPO_SLUG="arduino/arduino-lint"
35
+ if [[
36
+ (
37
+ # Only run on branch creation when it is a release branch.
38
+ # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
39
+ "${{ github.event_name }}" != "create" ||
40
+ "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
41
+ ) &&
42
+ (
43
+ # Only run when the workflow will have access to the certificate secrets.
44
+ # This could be done via a GitHub Actions workflow conditional, but makes more sense to do it here as well.
45
+ (
46
+ "${{ github.event_name }}" != "pull_request" &&
47
+ "${{ github.repository }}" == "$REPO_SLUG"
48
+ ) ||
49
+ (
50
+ "${{ github.event_name }}" == "pull_request" &&
51
+ "${{ github.event.pull_request.head.repo.full_name }}" == "$REPO_SLUG"
52
+ )
53
+ )
54
+ ]]; then
55
+ # Run the other jobs.
56
+ RESULT="true"
57
+ else
58
+ # There is no need to run the other jobs.
59
+ RESULT="false"
60
+ fi
61
+
62
+ echo "result=$RESULT" >> $GITHUB_OUTPUT
63
+
23
64
check-certificates :
24
65
name : ${{ matrix.certificate.identifier }}
25
- # Only run when the workflow will have access to the certificate secrets.
26
- if : >
27
- (github.event_name != 'pull_request' && github.repository == 'arduino/arduino-lint') ||
28
- (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'arduino/arduino-lint')
66
+ needs : run-determination
67
+ if : needs.run-determination.outputs.result == 'true'
29
68
runs-on : ubuntu-latest
30
69
permissions : {}
31
70
strategy :
0 commit comments