Skip to content

Commit a7335b2

Browse files
committed
fix FXA-13208: implement guidelines for github actions
1 parent 6a587b2 commit a7335b2

9 files changed

Lines changed: 63 additions & 45 deletions

.github/workflows/cleanup-storybooks.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ jobs:
1818

1919
steps:
2020
- name: Checkout gh-pages branch
21-
uses: actions/checkout@v6
21+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2222
with:
2323
ref: gh-pages
2424
path: gh-pages
2525
fetch-depth: 1
26+
persist-credentials: false
2627

2728
- name: Remove PR directory
2829
run: |
@@ -35,9 +36,10 @@ jobs:
3536
fi
3637
3738
- name: Checkout main branch for scripts
38-
uses: actions/checkout@v6
39+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
3940
with:
4041
path: main-repo
42+
persist-credentials: false
4143

4244
- name: Regenerate root index.html
4345
run: node main-repo/_scripts/generate-storybook-index.js

.github/workflows/close-stale-prs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
pull-requests: write
2020

2121
steps:
22-
- uses: actions/stale@v10
22+
- uses: actions/stale@b5d41d4e1d5dceea10e7104786b73624c18a190f # v10
2323
with:
2424
repo-token: ${{ secrets.GITHUB_TOKEN }}
2525
# ignore issues

.github/workflows/codeql-analysis.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ jobs:
3737

3838
steps:
3939
- name: Checkout repository
40-
uses: actions/checkout@v6
40+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
41+
with:
42+
persist-credentials: false
4143

4244
# Initializes the CodeQL tools for scanning.
4345
- name: Initialize CodeQL
44-
uses: github/codeql-action/init@v4
46+
uses: github/codeql-action/init@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4
4547
with:
4648
languages: ${{ matrix.language }}
4749
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -52,7 +54,7 @@ jobs:
5254
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5355
# If this step fails, then you should remove it and run the build manually (see below)
5456
- name: Autobuild
55-
uses: github/codeql-action/autobuild@v4
57+
uses: github/codeql-action/autobuild@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4
5658

5759
# ℹ️ Command-line programs to run using the OS shell.
5860
# 📚 https://git.io/JvXDl
@@ -66,4 +68,4 @@ jobs:
6668
# make release
6769

6870
- name: Perform CodeQL Analysis
69-
uses: github/codeql-action/analyze@v4
71+
uses: github/codeql-action/analyze@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4

.github/workflows/deploy-storybooks.yml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,24 @@ jobs:
2323

2424
steps:
2525
- name: Checkout repository
26-
uses: actions/checkout@v6
26+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2727
with:
2828
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
2929
fetch-depth: 0
3030
filter: tree:0
31+
persist-credentials: false
3132

3233
- name: Set NX_BASE and NX_HEAD for affected detection
3334
if: github.event_name == 'pull_request'
3435
run: |
35-
git fetch origin ${{ github.base_ref }}
36-
MERGE_BASE=$(git merge-base HEAD origin/${{ github.base_ref }})
36+
git fetch origin ${GITHUB_BASE_REF}
37+
MERGE_BASE=$(git merge-base HEAD origin/${GITHUB_BASE_REF})
3738
echo "NX_BASE=$MERGE_BASE" >> $GITHUB_ENV
3839
echo "NX_HEAD=HEAD" >> $GITHUB_ENV
3940
echo "Comparing against merge-base: $MERGE_BASE"
4041
4142
- name: Setup Node.js
42-
uses: actions/setup-node@v6
43+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
4344
with:
4445
node-version: '22'
4546
cache: 'yarn'
@@ -80,7 +81,7 @@ jobs:
8081

8182
- name: Upload storybooks artifact
8283
if: github.event_name == 'push' || steps.check-affected.outputs.has_storybooks == 'true'
83-
uses: actions/upload-artifact@v6
84+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
8485
with:
8586
name: storybooks-${{ github.event_name == 'pull_request' && github.event.pull_request.number || 'main' }}
8687
path: deploy/
@@ -100,17 +101,19 @@ jobs:
100101

101102
steps:
102103
- name: Checkout repository for scripts
103-
uses: actions/checkout@v6
104+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
104105
with:
105106
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
106107
path: repo
108+
persist-credentials: false
107109

108110
- name: Checkout gh-pages branch
109-
uses: actions/checkout@v6
111+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
110112
with:
111113
ref: gh-pages
112114
path: gh-pages
113115
fetch-depth: 1
116+
persist-credentials: false
114117

115118
- name: Set deployment directory
116119
id: deploy-dir
@@ -124,10 +127,12 @@ jobs:
124127
echo "DEPLOY_DIR=$DEPLOY_DIR" >> $GITHUB_ENV
125128
126129
- name: Remove old storybook directory
127-
run: rm -rf "gh-pages/${{ steps.deploy-dir.outputs.path }}"
130+
run: rm -rf "gh-pages/${DEPLOY_DIR_PATH}"
131+
env:
132+
DEPLOY_DIR_PATH: ${{ steps.deploy-dir.outputs.path }}
128133

129134
- name: Download storybooks artifact
130-
uses: actions/download-artifact@v7
135+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
131136
with:
132137
name: storybooks-${{ github.event_name == 'pull_request' && github.event.pull_request.number || 'main' }}
133138
path: gh-pages/${{ steps.deploy-dir.outputs.path }}
@@ -160,7 +165,7 @@ jobs:
160165
git push --force origin gh-pages-new:gh-pages
161166
162167
- name: Upload GitHub Pages artifact
163-
uses: actions/upload-pages-artifact@v4
168+
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4
164169
with:
165170
path: gh-pages/
166171

@@ -173,11 +178,11 @@ jobs:
173178
steps:
174179
- name: Deploy to GitHub Pages
175180
id: deployment
176-
uses: actions/deploy-pages@v4
181+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
177182

178183
- name: Create GitHub status check
179184
if: github.event_name == 'pull_request'
180-
uses: actions/github-script@v8
185+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
181186
with:
182187
script: |
183188
const deployDir = "${{ needs.prepare.outputs.deploy_dir }}";

.github/workflows/docker.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ jobs:
7474
needs:
7575
- tag
7676
steps:
77-
- uses: actions/checkout@v6
77+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
7878
with:
7979
ref: ${{ env.GIT_TAG }}
80+
persist-credentials: false
8081

8182
- name: Verify tag checkout and commit
8283
shell: bash
@@ -88,7 +89,7 @@ jobs:
8889
git describe --tags --exact-match | grep -Fx "$GIT_TAG"
8990
git show -s --format='%H %D' HEAD
9091
91-
- uses: actions/setup-node@v6
92+
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
9293
with:
9394
cache: yarn
9495

@@ -108,10 +109,10 @@ jobs:
108109
echo "apps/version.json:"
109110
cat ./apps/version.json
110111
111-
- uses: docker/setup-buildx-action@v3
112+
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
112113

113114
- id: meta
114-
uses: docker/metadata-action@v5
115+
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
115116
with:
116117
images: |
117118
${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.GAR_REPOSITORY}}/${{ env.IMAGE}}
@@ -120,26 +121,26 @@ jobs:
120121
type=raw,${{ env.GIT_TAG }}
121122
122123
- id: gcp-auth
123-
uses: google-github-actions/auth@v3
124+
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3
124125
with:
125126
token_format: 'access_token'
126127
service_account: artifact-writer@${{ env.GCP_PROJECT_ID}}.iam.gserviceaccount.com
127128
workload_identity_provider: ${{ vars.GCPV2_GITHUB_WORKLOAD_IDENTITY_PROVIDER }}
128129

129130
- id: dockerhub-auth
130-
uses: docker/login-action@v3
131+
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
131132
with:
132133
username: ${{ vars.DOCKERHUB_USERNAME }}
133134
password: ${{ secrets.DOCKERHUB_PASSWORD }}
134135

135-
- uses: docker/login-action@v3
136+
- uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
136137
with:
137138
registry: ${{ env.GAR_LOCATION }}-docker.pkg.dev
138139
username: oauth2accesstoken
139140
password: ${{ steps.gcp-auth.outputs.access_token }}
140141

141142
- id: build-and-push
142-
uses: docker/build-push-action@v6
143+
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
143144
with:
144145
context: .
145146
file: _dev/docker/mono/Dockerfile

.github/workflows/l10n-gettext-extract.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,24 @@ jobs:
1212
sudo apt update
1313
sudo apt install gettext -y
1414
- name: Set up Node
15-
uses: actions/setup-node@v6
15+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
1616
with:
1717
node-version: 18
1818
- name: Install global npm packages
1919
run: |
2020
yarn global add grunt-cli
2121
- name: Clone l10n repository
22-
uses: actions/checkout@v6
22+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2323
with:
2424
repository: mozilla/fxa-content-server-l10n
2525
path: 'fxa-l10n'
26+
persist-credentials: false
2627
- name: Clone FxA code repository
27-
uses: actions/checkout@v6
28+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2829
with:
2930
fetch-depth: 2
3031
path: 'fxa-code'
32+
persist-credentials: false
3133
- name: Install npm packages
3234
run: |
3335
cd fxa-l10n

.github/workflows/pull-legal-docs.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,20 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Clone FxA code repository
17-
uses: actions/checkout@v6
17+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1818
with:
1919
path: fxa
2020
fetch-depth: 2
21+
persist-credentials: false
2122

2223
- name: Clone legal-docs repository
23-
uses: actions/checkout@v6
24+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2425
with:
2526
repository: mozilla/legal-docs
2627
ref: prod
2728
path: legal-docs
2829
token: ${{ secrets.GITHUB_TOKEN }}
30+
persist-credentials: false
2931

3032
- name: Pull pdfs from legal-docs and push changes to FxA
3133
run: |

.github/workflows/tag-release.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ jobs:
1717
shell: bash
1818

1919
- name: Check out code
20-
uses: actions/checkout@v6
20+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
21+
with:
22+
persist-credentials: false
2123

2224
- name: Fetch all git tags
2325
run: git fetch --tags origin
@@ -29,23 +31,23 @@ jobs:
2931
- name: Add git tag to output
3032
id: echo
3133
run: |
32-
echo tag=v1.${{ env.versionNumber }}.0 >> $GITHUB_OUTPUT
34+
echo tag=v1.${versionNumber}.0 >> $GITHUB_OUTPUT
3335
3436
- name: Create release branch
35-
run: git checkout -b train-${{ env.versionNumber }}
37+
run: git checkout -b train-${versionNumber}
3638

3739
- name: Initialize mandatory git config
3840
run: |
39-
git config user.name "${{ github.triggering_actor }}"
41+
git config user.name "${GITHUB_TRIGGERING_ACTOR}"
4042
git config user.email "[email protected]"
4143
4244
- name: Commit update to branch
4345
if: env.versionNumber != ''
4446
run: |
45-
git push origin train-${{ env.versionNumber }}
47+
git push origin train-${versionNumber}
4648
4749
- name: Make a new tag
4850
if: env.versionNumber != ''
4951
run: |
50-
git tag -a "v1.${{ env.versionNumber }}.0" -m "Train release ${{ env.versionNumber }}"
51-
git push origin v1.${{ env.versionNumber }}.0
52+
git tag -a "v1.${versionNumber}.0" -m "Train release ${versionNumber}"
53+
git push origin v1.${versionNumber}.0

.github/workflows/upload-assets-to-cdn.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ jobs:
2121
contents: read
2222
steps:
2323
- name: Checkout repository
24-
uses: actions/checkout@v6
24+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
25+
with:
26+
persist-credentials: false
2527

2628
- name: Configure Stage AWS credentials
27-
uses: aws-actions/configure-aws-credentials@master
29+
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6
2830
with:
2931
aws-region: us-east-1
3032
role-to-assume: arn:aws:iam::142069644989:role/fxa-content-cdn-stage-asset-upload
@@ -37,7 +39,7 @@ jobs:
3739
aws s3 sync --cache-control 'public,max-age=86400' --exclude "*" --include "*.pdf" --content-disposition attachment assets/legal s3://fxa-content-cdn-stage-distbucket-bpquvfnty86g/legal
3840
3941
- name: Configure Production AWS credentials
40-
uses: aws-actions/configure-aws-credentials@master
42+
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6
4143
with:
4244
aws-region: us-west-2
4345
role-to-assume: arn:aws:iam::361527076523:role/fxa-content-cdn-prod-asset-upload
@@ -50,7 +52,7 @@ jobs:
5052
aws s3 sync --cache-control 'public,max-age=86400' --exclude "*" --include "*.pdf" --content-disposition attachment assets/legal s3://fxa-content-cdn-prod-distbucket-gqg70i8xqycy/legal
5153
5254
- name: Configure Stage GCP credentials
53-
uses: google-github-actions/auth@v3
55+
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3
5456
with:
5557
service_account: gke-cdn-upload-stage@${{ secrets.GCP_NONPROD_PROJECT_ID }}.iam.gserviceaccount.com
5658
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_POOL_PROJECT_NUMBER }}
@@ -62,7 +64,7 @@ jobs:
6264
gcloud storage cp --cache-control='public,max-age=86400' --content-disposition=attachment -r assets/legal/* gs://fxa-content-cdn-stage-distbucket/legal/
6365
6466
- name: Configure Prod GCP credentials
65-
uses: google-github-actions/auth@v3
67+
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3
6668
with:
6769
service_account: gke-cdn-upload-prod@${{ secrets.GCP_PROD_PROJECT_ID }}.iam.gserviceaccount.com
6870
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_POOL_PROJECT_NUMBER }}
@@ -74,7 +76,7 @@ jobs:
7476
gcloud storage cp --cache-control='public,max-age=86400' --content-disposition=attachment -r assets/legal/* gs://fxa-content-cdn-prod-distbucket/legal/
7577
7678
- name: "Post to fxa-team Slack channel"
77-
uses: slackapi/[email protected]
79+
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
7880
with:
7981
method: 'chat.postMessage'
8082
token: ${{ secrets.SLACK_BOT_TOKEN }}

0 commit comments

Comments
 (0)