File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -175,10 +175,13 @@ jobs:
175
175
else
176
176
# If running in a PR, diff against the PR's base.
177
177
# "git merge-base main branch_name" will give the common ancestor of both branches.
178
- MERGE_BASE=$(git merge-base origin/${{github.event.pull_request.head.ref}} origin/${{github.event.pull_request.base.ref}})
179
- echo "::warning ::Auto-diff origin/${{github.event.pull_request.head.ref}}..${MERGE_BASE}"
180
- git diff --name-only origin/${{github.event.pull_request.head.ref}}..${MERGE_BASE}
181
- echo "AUTO_DIFF_PARAM=--auto_diff origin/${{github.event.pull_request.head.ref}}..${MERGE_BASE}" >> $GITHUB_ENV
178
+ MERGE_BASE=$(git merge-base origin/${{github.event.pull_request.head.ref}} origin/${{github.event.pull_request.base.ref}} || true)
179
+ # If origin/<branch> is no longer valid, then just run all tests.
180
+ if [[ -n "${MERGE_BASE}" ]]; then
181
+ echo "::warning ::Auto-diff origin/${{github.event.pull_request.head.ref}}..${MERGE_BASE}"
182
+ git diff --name-only origin/${{github.event.pull_request.head.ref}}..${MERGE_BASE}
183
+ echo "AUTO_DIFF_PARAM=--auto_diff origin/${{github.event.pull_request.head.ref}}..${MERGE_BASE}" >> $GITHUB_ENV
184
+ fi
182
185
fi
183
186
- id : export-result
184
187
# e.g. 'ubuntu-latest,macos-latest' -> '["ubuntu-latest","macos-latest"]'
You can’t perform that action at this time.
0 commit comments