Skip to content

Commit 31af4d0

Browse files
committed
ci: be explicit
1 parent 6ad3b9f commit 31af4d0

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

.github/workflows/pull_request.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,22 @@ jobs:
6868

6969
- name: Set Base and Head Refs
7070
run: |
71-
BASE_REF="${{ github.event.pull_request.base.ref }}"
72-
HEAD_REF="${{ github.event.pull_request.head.ref }}"
73-
BASE_REMOTE="${{github.event.pull_request.base.repo.clone_url}}"
74-
HEAD_REMOTE="${{github.event.pull_request.head.repo.clone_url}}"
75-
76-
echo "BASE_REF=$BASE_REF" >> $GITHUB_ENV
77-
echo "HEAD_REF=$HEAD_REF" >> $GITHUB_ENV
78-
echo "BASE_REMOTE=$BASE_REMOTE" >> $GITHUB_ENV
79-
echo "HEAD_REMOTE=$HEAD_REMOTE" >> $GITHUB_ENV
71+
echo "BASE_REF=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
72+
echo "HEAD_REF=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
73+
echo "BASE_REMOTE=${{github.event.pull_request.base.repo.clone_url}}" >> $GITHUB_ENV
74+
echo "HEAD_REMOTE=${{github.event.pull_request.head.repo.clone_url}}" >> $GITHUB_ENV
8075
8176
- name: Fetch Branches
8277
run: |
83-
git fetch ${BASE_REMOTE} ${BASE_REF}
84-
git fetch ${HEAD_REMOTE} ${HEAD_REF}
78+
git remote add base $BASE_REMOTE
79+
git fetch base $BASE_REF
80+
81+
git remote add head $HEAD_REMOTE
82+
git fetch head $HEAD_REF
8583
8684
- name: Detect Added Submodules
8785
run: |
88-
ADDED_SUBMODULES=$(git diff --submodule ${BASE_REF}..${{github.sha}} | grep '^Submodule' | awk '{ print $2 }')
86+
ADDED_SUBMODULES=$(git diff --submodule remotes/base/${BASE_REF}..remotes/head/${HEAD_SHA} | grep '^Submodule' | awk '{ print $2 }')
8987
echo "Added submodules: $ADDED_SUBMODULES"
9088
echo "ADDED_SUBMODULES=$ADDED_SUBMODULES" >> $GITHUB_ENV
9189

0 commit comments

Comments
 (0)