Skip to content

Commit c8e0753

Browse files
authored
[Infrastructure] O2 linter: Checkout the script from the base branch (#14683)
1 parent 587053e commit c8e0753

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

.github/workflows/o2-linter.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Find issues in O2 code
33
name: O2 linter
44

5-
# "on": [pull_request_target, push]
5+
"on": [pull_request_target, push]
66
permissions: {}
77
env:
88
BRANCH_MAIN: master
@@ -47,6 +47,8 @@ jobs:
4747
fi
4848
echo "linter_ran=1" >> "$GITHUB_OUTPUT"
4949
[[ "${{ github.event_name }}" == "pull_request_target" ]] && options="-g"
50+
# Checkout the script from the base branch to prevent execution of arbitrary code in the head branch.
51+
git checkout ${{ env.BRANCH_BASE }} -- Scripts/o2_linter.py
5052
# shellcheck disable=SC2086 # Ignore unquoted options.
5153
python3 Scripts/o2_linter.py $options "${files[@]}"
5254
echo "Tip: If you allow actions in your fork repository, O2 linter will run when you push commits."

0 commit comments

Comments
 (0)