Skip to content

Stabilize Release workflow PR creation by replacing gh pr create with REST API flow - #137

Merged
manast merged 2 commits into
masterfrom
copilot/fix-release-job-failure
Jul 25, 2026
Merged

Stabilize Release workflow PR creation by replacing gh pr create with REST API flow#137
manast merged 2 commits into
masterfrom
copilot/fix-release-job-failure

Conversation

Copilot AI commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

The Release workflow was failing after semantic-release completed because PR creation intermittently failed via GitHub CLI’s GraphQL path. This change hardens the PR-creation step and makes reruns safe.

  • Root cause addressed

    • Release job failed at gh pr create with a GraphQL execution error, despite successful release branch creation/push.
  • Workflow changes (.github/workflows/release.yml)

    • Replaced gh pr create with gh api REST call to POST /repos/{owner}/{repo}/pulls.
    • Added pre-check for an existing open PR on the release branch (head=owner:branch, base=master) to avoid duplicate PR attempts on reruns.
    • Kept release branch naming, commit content, and base branch behavior unchanged.
  • Behavioral impact

    • Release step remains: semantic-release updates files → branch/commit/push → PR opened.
    • If a matching PR already exists, workflow logs and continues instead of failing.
EXISTING_PR_URL=$(gh api "repos/${{ github.repository }}/pulls?head=${{ github.repository_owner }}:${BRANCH_NAME}&base=master&state=open" --jq '.[0].html_url // empty')

if [[ -n "$EXISTING_PR_URL" ]]; then
  echo "Release PR already exists: ${EXISTING_PR_URL}"
else
  gh api --method POST "repos/${{ github.repository }}/pulls" \
    -f title="$PR_TITLE" -f body="$PR_BODY" -f head="$BRANCH_NAME" -f base="master"
fi

Copilot AI changed the title [WIP] Fix failing GitHub Actions job Release Stabilize Release workflow PR creation by replacing gh pr create with REST API flow Jul 24, 2026
Copilot AI requested a review from manast July 24, 2026 21:05
@manast
manast requested a review from roggervalf July 24, 2026 21:05
@manast
manast marked this pull request as ready for review July 24, 2026 21:06
Copilot AI review requested due to automatic review settings July 24, 2026 21:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the release workflow’s “open a release PR” step by replacing gh pr create (GraphQL) with a REST-based gh api flow and adding an “existing open PR” pre-check to make reruns less error-prone.

Changes:

  • Builds PR title/body as variables and creates the PR via POST /repos/{owner}/{repo}/pulls using gh api.
  • Adds a pre-check for an existing open PR matching head=owner:branch and base=master to avoid duplicates on reruns.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/release.yml
@manast
manast merged commit 2137de1 into master Jul 25, 2026
5 checks passed
@manast
manast deleted the copilot/fix-release-job-failure branch July 25, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants