fix(ci): support fork pr in ci (#52)

This commit is contained in:
Cuiys
2026-02-02 15:32:04 +08:00
committed by GitHub
parent f3db03ffbb
commit b5f0469ab4
2 changed files with 6 additions and 4 deletions
+3 -2
View File
@@ -59,8 +59,9 @@ jobs:
git config --global --add safe.directory "$CLEAN_WORKSPACE"
git clone --recursive "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" .
if [ -n "${{ github.event.pull_request.head.sha }}" ]; then
git checkout "${{ github.event.pull_request.head.sha }}"
if [ -n "${{ github.event.number }}" ]; then
git fetch origin "pull/${{ github.event.number }}/head"
git checkout FETCH_HEAD
else
git checkout "${{ github.sha }}"
fi
+3 -2
View File
@@ -62,8 +62,9 @@ jobs:
git config --global --add safe.directory "$CLEAN_WORKSPACE"
git clone --recursive "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" .
if [ -n "${{ github.event.pull_request.head.sha }}" ]; then
git checkout "${{ github.event.pull_request.head.sha }}"
if [ -n "${{ github.event.number }}" ]; then
git fetch origin "pull/${{ github.event.number }}/head"
git checkout FETCH_HEAD
else
git checkout "${{ github.sha }}"
fi