Fix checkout to use head_ref for PRs
All checks were successful
Test CI / test (pull_request) Successful in 0s
All checks were successful
Test CI / test (pull_request) Successful in 0s
gitea.ref_name returns PR number for pull_request events, need to use gitea.head_ref to get the actual branch name. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
b2c5716e21
commit
66c20e8edd
1 changed files with 5 additions and 2 deletions
|
|
@ -12,7 +12,9 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout (git clone)
|
- name: Checkout (git clone)
|
||||||
run: |
|
run: |
|
||||||
git clone --depth 1 --branch "${{ gitea.ref_name }}" \
|
# For PRs use head_ref (branch name), for pushes use ref_name
|
||||||
|
BRANCH="${{ gitea.head_ref || gitea.ref_name }}"
|
||||||
|
git clone --depth 1 --branch "$BRANCH" \
|
||||||
"${{ gitea.server_url }}/${{ gitea.repository }}.git" .
|
"${{ gitea.server_url }}/${{ gitea.repository }}.git" .
|
||||||
env:
|
env:
|
||||||
GIT_SSL_NO_VERIFY: "true"
|
GIT_SSL_NO_VERIFY: "true"
|
||||||
|
|
@ -22,5 +24,6 @@ jobs:
|
||||||
echo "Hello from Forgejo Actions!"
|
echo "Hello from Forgejo Actions!"
|
||||||
echo "Runner: $(hostname)"
|
echo "Runner: $(hostname)"
|
||||||
echo "Repository: ${{ gitea.repository }}"
|
echo "Repository: ${{ gitea.repository }}"
|
||||||
echo "Branch: ${{ gitea.ref_name }}"
|
echo "Event: ${{ gitea.event_name }}"
|
||||||
|
echo "Ref: ${{ gitea.ref }}"
|
||||||
ls -la
|
ls -la
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue