Skip to content

Commit 4353c17

Browse files
kylemcdclaude
andauthored
chore(ci): pin actions to SHAs and restrict default workflow permissions (#994)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 052f2d5 commit 4353c17

5 files changed

Lines changed: 24 additions & 15 deletions

File tree

.github/workflows/cicd.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
branches:
88
- main
99

10+
permissions:
11+
contents: read
12+
1013
concurrency:
1114
group: ${{ github.workflow }}-${{ github.ref }}
1215
cancel-in-progress: true
@@ -15,9 +18,9 @@ jobs:
1518
test:
1619
runs-on: ubuntu-latest
1720
steps:
18-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
1922

20-
- uses: actions/setup-node@v4
23+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
2124
with:
2225
node-version: "20.x"
2326
registry-url: "https://registry.npmjs.org"
@@ -44,13 +47,13 @@ jobs:
4447
run: yarn test:ci
4548

4649
- name: Upload results to Codecov
47-
uses: codecov/codecov-action@v5
50+
uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5.5.4
4851
with:
4952
token: ${{ secrets.CODECOV_TOKEN }}
5053
slug: knocklabs/javascript
5154

5255
- name: Upload test results to Codecov
5356
if: ${{ !cancelled() }}
54-
uses: codecov/test-results-action@v1
57+
uses: codecov/test-results-action@0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3 # v1.2.1
5558
with:
5659
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/dependabot-changeset.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
4646
# Checkout the PR branch for package.json analysis and committing.
4747
- name: Checkout PR branch
48-
uses: actions/checkout@v4
48+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
4949
with:
5050
ref: ${{ steps.pr.outputs.ref }}
5151
token: ${{ secrets.KNOCK_ENG_BOT_GITHUB_TOKEN }}
@@ -55,14 +55,14 @@ jobs:
5555
# This ensures we never execute code from an untrusted PR branch
5656
# when triggered via workflow_dispatch.
5757
- name: Checkout trusted script from main
58-
uses: actions/checkout@v4
58+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
5959
with:
6060
ref: main
6161
sparse-checkout: .github/scripts
6262
path: .trusted
6363

6464
- name: Setup Node.js
65-
uses: actions/setup-node@v4
65+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
6666
with:
6767
node-version-file: "package.json"
6868

.github/workflows/expo.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ on:
33
pull_request:
44
workflow_dispatch:
55

6+
permissions:
7+
contents: read
8+
69
jobs:
710
build:
811
name: Install and build
912
runs-on: ubuntu-latest
1013
steps:
11-
- uses: actions/checkout@v4
12-
- uses: actions/setup-node@v4
14+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
15+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
1316
with:
1417
node-version: "22.x"
1518
cache: yarn
@@ -20,7 +23,7 @@ jobs:
2023
- name: Build packages
2124
run: yarn build:packages
2225
- name: Setup Expo and EAS
23-
uses: expo/expo-github-action@v8
26+
uses: expo/expo-github-action@c7b66a9c327a43a8fa7c0158e7f30d6040d2481e # 8.2.1
2427
with:
2528
eas-version: latest
2629
token: ${{ secrets.EXPO_TOKEN }}

.github/workflows/integration.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
pull_request:
55
workflow_dispatch:
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
run-integration-tests:
912
strategy:
@@ -17,9 +20,9 @@ jobs:
1720
INTEGRATION_KNOCK_FEED_ID: ${{ secrets.INTEGRATION_KNOCK_FEED_ID }}
1821
steps:
1922
- name: Checkout Latest
20-
uses: actions/checkout@v4
23+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
2124
- name: Setup Node
22-
uses: actions/setup-node@v4
25+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
2326
with:
2427
node-version-file: "package.json"
2528
cache: "yarn"

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
# Checkout the repository with full history and tag data so that
2121
# Changesets can generate changelogs and tag new releases appropriately.
2222
- name: Checkout Repo
23-
uses: actions/checkout@v4
23+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
2424
with:
2525
fetch-tags: true
2626
fetch-depth: 0
@@ -44,7 +44,7 @@ jobs:
4444
# Set up Node.js using the version specified in package.json,
4545
# and cache Yarn dependencies for faster installs.
4646
- name: Setup Node.js 20.x
47-
uses: actions/setup-node@v4
47+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
4848
with:
4949
registry-url: "https://registry.npmjs.org"
5050
node-version-file: "package.json"
@@ -115,7 +115,7 @@ jobs:
115115
# Create a versioning PR if changeset files exist, or publish packages
116116
# to npm if version bump commits have already been merged into the branch.
117117
- name: Create release PR or publish
118-
uses: changesets/action@v1
118+
uses: changesets/action@63a615b9cd06ba9a3e6d13796c7fbcb080a60a0b # v1.8.0
119119
with:
120120
commit: "chore(repo): version packages for ${{ steps.release-type.outputs.release-type }}"
121121
title: "chore(repo): version packages for ${{ steps.release-type.outputs.release-type }}"

0 commit comments

Comments
 (0)