Skip to content

Commit 6f60b4a

Browse files
committed
Fix string injection vulnerability on CI
1 parent d1c33b2 commit 6f60b4a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

.github/workflows/enforce_branch_name.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Check PR source branch
12+
env:
13+
IS_FORK: ${{ github.event.pull_request.head.repo.fork }}
14+
HEAD_REF: ${{ github.event.pull_request.head.ref }}
1215
run: |
1316
# Check if PR is from a fork
14-
if [[ "${{ github.event.pull_request.head.repo.fork }}" == "true" ]]; then
17+
if [[ "${IS_FORK}" == "true" ]]; then
1518
# Check if PR is from the master/main branch of a fork
16-
if [[ "${{ github.event.pull_request.head.ref }}" == "master" || "${{ github.event.pull_request.head.ref }}" == "main" ]]; then
19+
if [[ "${HEAD_REF}" == "master" || "${HEAD_REF}" == "main" ]]; then
1720
echo "ERROR: Pull requests from the master/main branch of forks are not allowed, because it prevents maintainers from contributing to your PR"
1821
echo "Please create a feature branch in your fork and submit the PR from that branch instead."
1922
exit 1

0 commit comments

Comments
 (0)