Skip to content

Commit d93c35d

Browse files
authored
Merge pull request #453 from opf/chore/zizmor
Add zizmor scan
2 parents 6cd86b3 + f78d4ce commit d93c35d

24 files changed

Lines changed: 280 additions & 121 deletions

.github/actions/upload-versions/action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ runs:
1616
node-version: 24
1717
- name: Write workspace versions as JSON file
1818
uses: actions/github-script@a3e7071a34d7e1f219a8a4de9a5e0a34d1ee1293
19+
env:
20+
PACKAGE_PATHS: ${{ inputs.package_paths }}
1921
with:
2022
script: |
2123
const fs = require('node:fs');
2224
23-
const globber = await glob.create(`${{ inputs.package_paths }}`)
25+
const globber = await glob.create(process.env.PACKAGE_PATHS)
2426
const packageJsonPaths = await globber.glob()
2527
const output = {
2628
packages: [],

.github/dependabot.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ updates:
1717
all-actions:
1818
update-types:
1919
- "patch"
20+
cooldown:
21+
default-days: 7
2022

2123
# NPM
2224
- package-ecosystem: "npm"
@@ -36,6 +38,8 @@ updates:
3638
dependency-type: "development"
3739
update-types:
3840
- "patch"
41+
cooldown:
42+
default-days: 7
3943

4044
- package-ecosystem: "npm"
4145
directory: "/demo"
@@ -49,6 +53,8 @@ updates:
4953
all-demo:
5054
update-types:
5155
- "patch"
56+
cooldown:
57+
default-days: 7
5258

5359

5460
# Bundler
@@ -69,6 +75,8 @@ updates:
6975
dependency-type: "development"
7076
update-types:
7177
- "patch"
78+
cooldown:
79+
default-days: 7
7280
- package-ecosystem: "bundler"
7381
directory: "/demo"
7482
schedule:
@@ -80,4 +88,6 @@ updates:
8088
groups:
8189
all-demo:
8290
update-types:
83-
- "patch"
91+
- "patch"
92+
cooldown:
93+
default-days: 7

.github/workflows/accessibility-alt-text-bot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ jobs:
2323
if: ${{ github.event.issue || github.event.pull_request || github.event.discussion }}
2424
steps:
2525
- name: Get action 'github/accessibility-alt-text-bot'
26-
uses: github/accessibility-alt-text-bot@v1.7.3
26+
uses: github/accessibility-alt-text-bot@7e895d46677f15841def9acef1239ea7c12593a5 # v1.7.3

.github/workflows/codeql-analysis.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,34 @@ on:
66
schedule:
77
- cron: '37 7 * * 1'
88

9+
permissions: {}
10+
911
jobs:
1012
analyze:
1113
name: Analyze
1214
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
security-events: write
1318

1419
steps:
1520
- name: Checkout repository
16-
uses: actions/checkout@v6
21+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
22+
with:
23+
persist-credentials: false
1724

1825
# Initializes the CodeQL tools for scanning.
1926
- name: Initialize CodeQL
20-
uses: github/codeql-action/init@v4
27+
uses: github/codeql-action/init@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4
2128
with:
2229
languages: javascript
2330

24-
- uses: actions/setup-node@v5
31+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
2532
with:
2633
node-version: 20
2734
cache: 'npm'
2835
- run: |
2936
npm ci
3037
3138
- name: Perform CodeQL Analysis
32-
uses: github/codeql-action/analyze@v4
39+
uses: github/codeql-action/analyze@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4

.github/workflows/demo-preview-cleanup.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
name: preview
2424

2525
steps:
26-
- uses: Azure/login@v3
26+
- uses: Azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3
2727
with:
2828
# excluding a client secret here will cause a login via OpenID Connect (OIDC),
2929
# which prevents us from having to rotate client credentials, etc
@@ -32,12 +32,14 @@ jobs:
3232
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
3333

3434
# Do this before repo checkout to prevent running bundle install
35-
- uses: ruby/setup-ruby@v1
35+
- uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1
3636
with:
3737
ruby-version: '3.3'
3838

3939
- name: Check out repo
40-
uses: actions/checkout@v6
40+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
41+
with:
42+
persist-credentials: false
4143

4244
# Delete web app (which will also delete the App Service plan)
4345
# This will succeed even if the app doesn't exist / has already been deleted

.github/workflows/demo-preview-destroy.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
PR_NUMBER: ${{ github.event.number || github.event.inputs.PR_NUMBER }}
2727

2828
steps:
29-
- uses: Azure/login@v3
29+
- uses: Azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3
3030
with:
3131
# excluding a client secret here will cause a login via OpenID Connect (OIDC),
3232
# which prevents us from having to rotate client credentials, etc
@@ -35,22 +35,24 @@ jobs:
3535
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
3636

3737
- name: Check out repo
38-
uses: actions/checkout@v6
38+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
39+
with:
40+
persist-credentials: false
3941

4042
- name: Get preview app info
4143
run: ./.github/workflows/demo-preview-app-info.sh
4244

4345
# Succeed despite any non-zero exit code (e.g. if there is no deployment to cancel)
4446
- name: 'Cancel any in progress deployments'
4547
run: |
46-
az deployment group cancel --name ${{ env.DEPLOYMENT_NAME }} -g primer || true
48+
az deployment group cancel --name ${DEPLOYMENT_NAME} -g primer || true
4749
# Delete web app (which will also delete the App Service plan)
4850
# This will succeed even if the app doesn't exist / has already been deleted
4951
- name: 'Delete App Service App (which will also delete the App Service plan)'
5052
run: |
51-
az container delete -n ${{ env.APP_NAME }} -g primer -y &> /dev/null
53+
az container delete -n ${APP_NAME} -g primer -y &> /dev/null
5254
# Untag all images under this PR's container registry repo - the container registry will automatically remove untagged images.
5355
# This will fail if the IMAGE_REPO doesn't exist, but we don't care
5456
- name: 'Untag all docker images for this PR'
5557
run: |
56-
az acr repository delete -n primer.azurecr.io --repository ${{ env.IMAGE_REPO }} -y || true
58+
az acr repository delete -n primer.azurecr.io --repository ${IMAGE_REPO} -y || true

.github/workflows/demo-production-deploy.yml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,22 @@ on:
77
branches:
88
- DO_NOT_EXECUTE_THIS_WORKFLOW
99

10-
permissions:
11-
id-token: write # This is required for requesting the OIDC JWT for authing with Azure
12-
contents: read # This is required for actions/checkout
10+
permissions: {}
1311

1412
jobs:
1513
build:
1614
if: ${{ github.repository == 'primer/view_components' }}
1715
runs-on: ubuntu-latest
1816
environment: production
17+
permissions:
18+
id-token: write # This is required for requesting the OIDC JWT for authing with Azure
19+
contents: read # This is required for actions/checkout
1920
steps:
20-
- uses: actions/checkout@v6
21+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
22+
with:
23+
persist-credentials: false
2124
- name: Setup Ruby
22-
uses: ruby/setup-ruby@v1
25+
uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1
2326
with:
2427
ruby-version: '3.3'
2528
bundler-cache: true
@@ -28,7 +31,7 @@ jobs:
2831
env:
2932
AZURE_ACR_PASSWORD: ${{ secrets.AZURE_ACR_PASSWORD }}
3033
run: echo $AZURE_ACR_PASSWORD | docker login primer.azurecr.io --username GitHubActions --password-stdin
31-
- uses: Azure/login@v3
34+
- uses: Azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3
3235
with:
3336
# excluding a client secret here will cause a login via OpenID Connect (OIDC),
3437
# which prevents us from having to rotate client credentials, etc
@@ -65,22 +68,27 @@ jobs:
6568
runs-on: ubuntu-latest
6669
environment: production
6770
needs: build
71+
permissions:
72+
id-token: write # This is required for requesting the OIDC JWT for authing with Azure
73+
contents: read # This is required for actions/checkout
6874
steps:
69-
- uses: actions/checkout@v6
75+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
76+
with:
77+
persist-credentials: false
7078
- name: Setup Ruby
71-
uses: ruby/setup-ruby@v1
79+
uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1
7280
with:
7381
ruby-version: '3.3'
7482
bundler-cache: true
75-
- uses: actions/cache@v5.0.4
83+
- uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
7684
with:
7785
path: demo/gemfiles/vendor/bundle
7886
key: gems-build-kuby-main-ruby-3.3.x-${{ hashFiles('demo/gemfiles/kuby.gemfile.lock') }}
7987
- name: Bundle
8088
run: |
8189
gem install bundler -v '~> 2.3'
8290
bundle install --jobs 4 --retry 3 --gemfile demo/gemfiles/kuby.gemfile --path vendor/bundle
83-
- uses: Azure/login@v3
91+
- uses: Azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3
8492
with:
8593
# excluding a client secret here will cause a login via OpenID Connect (OIDC),
8694
# which prevents us from having to rotate client credentials, etc

.github/workflows/lint.yml

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,17 @@ on:
99
- main
1010
types:
1111
- checks_requested
12+
permissions: {}
1213
jobs:
1314
markdown:
1415
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
pull-requests: read
1519
steps:
16-
- uses: actions/checkout@v6
20+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
21+
with:
22+
persist-credentials: false
1723
- name: Get specific changed files
1824
id: changed-files
1925
uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323
@@ -23,22 +29,29 @@ jobs:
2329
README.md
2430
CONTRIBUTING.md
2531
CODE_OF_CONDUCT.md
26-
- uses: xt0rted/markdownlint-problem-matcher@v3
32+
- uses: xt0rted/markdownlint-problem-matcher@1a5fabfb577370cfdf5af944d418e4be3ea06f27 # v3
2733
if: steps.changed-files.outputs.any_changed == 'true'
28-
- uses: actions/setup-node@v5
34+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
2935
if: steps.changed-files.outputs.any_changed == 'true'
3036
with:
3137
cache: 'npm'
3238
- name: Lint with Markdownlint
3339
if: steps.changed-files.outputs.any_changed == 'true'
3440
run: |
3541
npm ci
36-
npx markdownlint-cli2 ${{ steps.changed-files.outputs.all_changed_files }}
42+
npx markdownlint-cli2 ${STEPS_CHANGED_FILES_OUTPUTS_ALL_CHANGED_FILES}
43+
env:
44+
STEPS_CHANGED_FILES_OUTPUTS_ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
3745

3846
rubocop:
3947
runs-on: ubuntu-latest
48+
permissions:
49+
contents: read
50+
pull-requests: read
4051
steps:
41-
- uses: actions/checkout@v6
52+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
53+
with:
54+
persist-credentials: false
4255
- name: Get specific changed files
4356
id: changed-files
4457
uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323
@@ -48,7 +61,7 @@ jobs:
4861
lib/**/*.rb
4962
demo/**/*.rb
5063
test/**/*.rb
51-
- uses: ruby/setup-ruby@v1
64+
- uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1
5265
with:
5366
ruby-version: '3.3'
5467
bundler-cache: true
@@ -57,15 +70,20 @@ jobs:
5770

5871
erblint:
5972
runs-on: ubuntu-latest
73+
permissions:
74+
contents: read
75+
pull-requests: read
6076
steps:
61-
- uses: actions/checkout@v6
77+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
78+
with:
79+
persist-credentials: false
6280
- name: Get changed files
6381
id: changed-files
6482
uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323
6583
with:
6684
files: |
6785
app/components/**/*.erb
68-
- uses: ruby/setup-ruby@v1
86+
- uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1
6987
with:
7088
ruby-version: '3.3'
7189
bundler-cache: true
@@ -74,49 +92,67 @@ jobs:
7492

7593
eslint:
7694
runs-on: ubuntu-latest
95+
permissions:
96+
contents: read
97+
pull-requests: read
7798
steps:
78-
- uses: actions/checkout@v6
99+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
100+
with:
101+
persist-credentials: false
79102
- name: Get changed files
80103
id: changed-files
81104
uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323
82105
with:
83106
files: |
84107
app/components/**/*.ts
85-
- uses: actions/setup-node@v5
108+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
86109
if: steps.changed-files.outputs.any_changed == 'true'
87110
with:
88111
cache: 'npm'
89112
- name: Lint with ESLint
90113
if: steps.changed-files.outputs.any_changed == 'true'
91114
run: |
92115
npm ci
93-
npx eslint --quiet ${{ steps.changed-files.outputs.all_changed_files }}
116+
npx eslint --quiet ${STEPS_CHANGED_FILES_OUTPUTS_ALL_CHANGED_FILES}
117+
env:
118+
STEPS_CHANGED_FILES_OUTPUTS_ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
94119

95120
stylelint:
96121
runs-on: ubuntu-latest
122+
permissions:
123+
contents: read
124+
pull-requests: read
97125
steps:
98-
- uses: actions/checkout@v6
126+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
127+
with:
128+
persist-credentials: false
99129
- name: Get changed files
100130
id: changed-files
101131
uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323
102132
with:
103133
files: |
104134
app/components/**/*.pcss
105135
lib/postcss_mixins/*.pcss
106-
- uses: actions/setup-node@v5
136+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
107137
if: steps.changed-files.outputs.any_changed == 'true'
108138
with:
109139
cache: 'npm'
110140
- name: Lint with Stylelint
111141
if: steps.changed-files.outputs.any_changed == 'true'
112142
run: |
113143
npm ci
114-
npx stylelint --rd -q ${{ steps.changed-files.outputs.all_changed_files }} --custom-formatter=stylelint-actions-formatters
144+
npx stylelint --rd -q ${STEPS_CHANGED_FILES_OUTPUTS_ALL_CHANGED_FILES} --custom-formatter=stylelint-actions-formatters
145+
env:
146+
STEPS_CHANGED_FILES_OUTPUTS_ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
115147

116148
herb:
117149
runs-on: ubuntu-latest
150+
permissions:
151+
contents: read
118152
steps:
119-
- uses: actions/checkout@v6
153+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
154+
with:
155+
persist-credentials: false
120156
- name: Lint with Herb
121157
run: |
122158
npx @herb-tools/linter@0.8.10

0 commit comments

Comments
 (0)