1
- name : actionlint
1
+ # This file is synced from the `.github` repository, do not modify it directly.
2
+ name : Actionlint
2
3
3
4
on :
4
5
push :
5
6
branches :
6
7
- main
7
- paths :
8
- - ' .github/workflows/*.ya?ml'
8
+ - master
9
9
pull_request :
10
- paths :
11
- - ' .github/workflows/*.ya?ml'
12
10
13
11
defaults :
14
12
run :
25
23
26
24
permissions : {}
27
25
28
- # FIXME: The `Install tools` step fails inside the Docker container for some reason.
29
26
jobs :
30
27
workflow_syntax :
31
28
if : github.repository_owner == 'Homebrew'
32
29
runs-on : ubuntu-latest
30
+ permissions :
31
+ contents : read
32
+ container :
33
+ image : ghcr.io/homebrew/ubuntu22.04:main
33
34
steps :
34
35
- name : Set up Homebrew
35
36
id : setup-homebrew
36
- uses : Homebrew/actions/setup-homebrew@master
37
+ uses : Homebrew/actions/setup-homebrew@main
37
38
with :
38
39
core : false
39
40
cask : false
@@ -47,26 +48,39 @@ jobs:
47
48
persist-credentials : false
48
49
49
50
- run : zizmor --format sarif . > results.sarif
51
+ env :
52
+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
50
53
51
54
- name : Upload SARIF file
52
55
uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
56
+ # We can't use the SARIF file when triggered by `merge_group` so we don't upload it.
57
+ if : always() && github.event_name != 'merge_group'
53
58
with :
54
59
name : results.sarif
55
60
path : results.sarif
56
61
57
62
- name : Set up actionlint
58
63
run : |
59
- # Setting `shell: /bin/bash` prevents shellcheck from running on
60
- # those steps, so let's change them to `shell: bash` for linting.
64
+ # In homebrew-core, setting `shell: /bin/bash` prevents shellcheck from running on
65
+ # those steps, so let's change them to `shell: bash` temporarily for better linting.
61
66
sed -i 's|shell: /bin/bash -x|shell: bash -x|' .github/workflows/*.y*ml
62
- # The JSON matcher needs to be accessible to the container host.
67
+
68
+ # In homebrew-core, the JSON matcher needs to be accessible to the container host.
63
69
cp "$(brew --repository)/.github/actionlint-matcher.json" "$HOME"
70
+
64
71
echo "::add-matcher::$HOME/actionlint-matcher.json"
65
72
66
73
- run : actionlint
67
74
68
75
upload_sarif :
69
76
needs : workflow_syntax
77
+ # We want to always upload this even if `actionlint` failed.
78
+ # This is only available on public repositories.
79
+ if : >
80
+ always() &&
81
+ !contains(fromJSON('["cancelled", "skipped"]'), needs.workflow_syntax.result) &&
82
+ !github.event.repository.private &&
83
+ github.event_name != 'merge_group'
70
84
runs-on : ubuntu-latest
71
85
permissions :
72
86
contents : read
0 commit comments