Skip to content

Commit ae06243

Browse files
authored
Ensure Trusted Code Checkout in GitHub Actions Workflow (#7034)
* feat: Ensure Trusted Code Checkout in GitHub Actions Workflow * fix: update GitHub event name
1 parent d9e0865 commit ae06243

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
6969
with:
7070
# Provides the Pull Request commit SHA or the GitHub merge group ref
71-
ref: ${{ github.event.pull_request.head.sha || github.ref }}
71+
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.ref }}
7272
# We only need to fetch the last commit from the head_ref
7373
# since we're not using the `--filter` operation from turborepo
7474
# We don't use the `--filter` as we always want to force builds regardless of having changes or not

.github/workflows/lighthouse.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
4747
with:
4848
# Provides the Pull Request commit SHA or the GitHub merge group ref
49-
ref: ${{ github.event.pull_request.head.sha || github.ref }}
49+
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.ref }}
5050

5151
- name: Add Comment to PR
5252
# Signal that a lighthouse run is about to start

.github/workflows/lint-and-tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
7474
with:
7575
# Provides the Pull Request commit SHA or the GitHub merge group ref
76-
ref: ${{ github.event.pull_request.head.sha || github.ref }}
76+
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.ref }}
7777

7878
- name: Restore Lint Cache
7979
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
@@ -167,7 +167,7 @@ jobs:
167167
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
168168
with:
169169
# Provides the Pull Request commit SHA or the GitHub merge group ref
170-
ref: ${{ github.event.pull_request.head.sha || github.ref }}
170+
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.ref }}
171171
# The Chromatic (@chromaui/action) Action requires a full history of the current branch in order to be able to compare
172172
# previous changes and previous commits and determine which Storybooks should be tested against and what should be built
173173
fetch-depth: 0

.github/workflows/translations-pr.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
7474
with:
7575
# Provides the Pull Request commit SHA or the GitHub merge group ref
76-
ref: ${{ github.event.pull_request.head.sha || github.ref }}
76+
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.ref }}
7777

7878
- name: Restore Lint Cache
7979
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2

0 commit comments

Comments
 (0)