Skip to content

Commit 1702ed2

Browse files
committed
CI: fix Jenkins job config for pull_request (use head ref and head repo)
- BRANCH: use github.head_ref for pull_request so Jenkins checks out PR source branch (github.ref_name is e.g. 127/merge which is not a fetchable branch) - REPO_URL: use head repo for pull_request so fork PRs clone the correct repo
1 parent a93bc4c commit 1702ed2

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ jobs:
7171
7272
- name: Create ci-demo job (Jenkins CLI)
7373
env:
74-
REPO_URL: "https://github.com/${{ github.repository }}.git"
75-
BRANCH: "${{ github.ref_name }}"
74+
# For pull_request use head repo (PR source) so Jenkins can fetch the branch; for push use current repo
75+
REPO_URL: "https://github.com/${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}.git"
76+
# For pull_request use head ref (PR source branch); for push use ref_name (avoids invalid refs like 127/merge)
77+
BRANCH: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
7678
run: |
7779
sed -e "s|REPO_URL_PLACEHOLDER|${REPO_URL}|g" \
7880
-e "s|BRANCH_PLACEHOLDER|${BRANCH}|g" \

0 commit comments

Comments
 (0)