File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 4949 VERSION=${TAG%%-*}
5050 BRANCH_NAME="${VERSION}-maintenance"
5151
52+ # Determine the target repository for the PR (upstream if fork, else current)
53+ TARGET_REPO=$(gh repo view --json parent --jq '.parent.nameWithOwner')
54+ if [[ -z "$TARGET_REPO" || "$TARGET_REPO" == "null" ]]; then
55+ TARGET_REPO="${{ github.repository }}"
56+ fi
57+ export GH_REPO="$TARGET_REPO"
58+ echo "Targeting repository: $GH_REPO"
59+
5260 if git ls-remote --heads origin "$VERSION" | grep -q "$VERSION"; then
5361 BASE_BRANCH="$VERSION"
5462 else
6573 git remote add fork "https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/${FORK_OWNER}/rancher-product-docs.git"
6674 git push -f fork "$BRANCH_NAME"
6775
68- PR_NUMBER=$(gh pr list --head "${FORK_OWNER}:${ BRANCH_NAME} " --base "$BASE_BRANCH" --json number --jq '.[0]. number' )
76+ PR_NUMBER=$(gh pr list --head "$BRANCH_NAME" --base "$BASE_BRANCH" --json number,headRepositoryOwner --jq ".[] | select(.headRepositoryOwner.login == \"$FORK_OWNER\") | . number" | head -n 1 )
6977
7078 if [[ -n "$PR_NUMBER" && "$PR_NUMBER" != "null" ]]; then
7179 gh pr edit "$PR_NUMBER" \
You can’t perform that action at this time.
0 commit comments