From e7e0abd34d3eaa9d582c99fa13801fafbdcda91c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 9 Jan 2026 01:28:05 +0000 Subject: [PATCH 1/5] Initial plan From 0e892ffda08d22df46f270c3d80bccfb2baa9cfd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 9 Jan 2026 01:31:58 +0000 Subject: [PATCH 2/5] feat: add automatic PR creation when version branch is created Co-authored-by: jmiller-moko <230051081+jmiller-moko@users.noreply.github.com> --- .github/workflows/version_branch.yml | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/.github/workflows/version_branch.yml b/.github/workflows/version_branch.yml index cb55333..c449819 100644 --- a/.github/workflows/version_branch.yml +++ b/.github/workflows/version_branch.yml @@ -44,6 +44,7 @@ concurrency: permissions: contents: write + pull-requests: write defaults: run: @@ -620,6 +621,49 @@ jobs: git push --set-upstream origin "${BRANCH_NAME}" + - name: Create pull request + if: ${{ env.REPORT_ONLY != 'true' }} + env: + GH_TOKEN: ${{ github.token }} + run: | + source "$CI_HELPERS" + moko_init "Create pull request" + + if [[ -z "${BRANCH_NAME:-}" ]]; then + echo "[FATAL] BRANCH_NAME not set." >&2 + exit 2 + fi + + PR_TITLE="Version branch ${NEW_VERSION}" + if [[ -n "${VERSION_TEXT}" ]]; then + PR_TITLE="${PR_TITLE} (${VERSION_TEXT})" + fi + + cat > /tmp/pr_body.txt <&2 + exit 0 + } + + echo "[INFO] Pull request created successfully" + - name: Publish audit trail if: always() run: | From b619b39dde2e6f5cd00a00c2b1e1aa2ea1a1f90d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 9 Jan 2026 01:32:47 +0000 Subject: [PATCH 3/5] refactor: improve PR creation error handling and remove trailing whitespace Co-authored-by: jmiller-moko <230051081+jmiller-moko@users.noreply.github.com> --- .github/workflows/version_branch.yml | 30 ++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/version_branch.yml b/.github/workflows/version_branch.yml index c449819..49959a5 100644 --- a/.github/workflows/version_branch.yml +++ b/.github/workflows/version_branch.yml @@ -651,18 +651,32 @@ jobs: EOF echo "[INFO] Creating pull request from ${BRANCH_NAME} to ${BASE_BRANCH}" - - gh pr create \ + + set +e + PR_OUTPUT=$(gh pr create \ --base "${BASE_BRANCH}" \ --head "${BRANCH_NAME}" \ --title "${PR_TITLE}" \ - --body-file /tmp/pr_body.txt \ - || { - echo "[WARN] Failed to create pull request. It may already exist or there may be no changes." >&2 - exit 0 - } + --body-file /tmp/pr_body.txt 2>&1) + PR_EXIT_CODE=$? + set -e - echo "[INFO] Pull request created successfully" + if [[ ${PR_EXIT_CODE} -eq 0 ]]; then + echo "[INFO] Pull request created successfully" + echo "${PR_OUTPUT}" + else + echo "[WARN] Failed to create pull request (exit code: ${PR_EXIT_CODE})" >&2 + echo "[WARN] Output: ${PR_OUTPUT}" >&2 + + # Check for common error conditions + if echo "${PR_OUTPUT}" | grep -iq "already exists"; then + echo "[INFO] PR likely already exists, continuing..." >&2 + elif echo "${PR_OUTPUT}" | grep -iq "no commits between"; then + echo "[INFO] No commits between branches, continuing..." >&2 + else + echo "[WARN] Unexpected error occurred, but continuing workflow" >&2 + fi + fi - name: Publish audit trail if: always() From a12da2ad5735ee0e516d451bf40f803559f7e7c9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 9 Jan 2026 01:35:12 +0000 Subject: [PATCH 4/5] fix: correct YAML formatting for heredoc in PR body generation Co-authored-by: jmiller-moko <230051081+jmiller-moko@users.noreply.github.com> --- .github/workflows/version_branch.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/version_branch.yml b/.github/workflows/version_branch.yml index 49959a5..3f2fe98 100644 --- a/.github/workflows/version_branch.yml +++ b/.github/workflows/version_branch.yml @@ -639,16 +639,20 @@ jobs: PR_TITLE="${PR_TITLE} (${VERSION_TEXT})" fi - cat > /tmp/pr_body.txt < /tmp/pr_body.txt <<'PRBODY' + Automated pull request created for version branch. This PR was automatically created by the version branch workflow. - EOF + PRBODY + + # Add dynamic content + { + echo "" + echo "Version: ${NEW_VERSION}" + echo "Version Text: ${VERSION_TEXT:-N/A}" + echo "Branch Prefix: ${BRANCH_PREFIX}" + echo "Base Branch: ${BASE_BRANCH}" + } >> /tmp/pr_body.txt echo "[INFO] Creating pull request from ${BRANCH_NAME} to ${BASE_BRANCH}" @@ -667,7 +671,7 @@ jobs: else echo "[WARN] Failed to create pull request (exit code: ${PR_EXIT_CODE})" >&2 echo "[WARN] Output: ${PR_OUTPUT}" >&2 - + # Check for common error conditions if echo "${PR_OUTPUT}" | grep -iq "already exists"; then echo "[INFO] PR likely already exists, continuing..." >&2 From a9c935dc4f26d90a7a6b332d4e661b212a2f09cf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 9 Jan 2026 01:36:41 +0000 Subject: [PATCH 5/5] refactor: improve PR body text and error pattern matching Co-authored-by: jmiller-moko <230051081+jmiller-moko@users.noreply.github.com> --- .github/workflows/version_branch.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/version_branch.yml b/.github/workflows/version_branch.yml index 3f2fe98..577ec15 100644 --- a/.github/workflows/version_branch.yml +++ b/.github/workflows/version_branch.yml @@ -640,9 +640,7 @@ jobs: fi cat > /tmp/pr_body.txt <<'PRBODY' - Automated pull request created for version branch. - - This PR was automatically created by the version branch workflow. + This pull request was automatically created by the version branch workflow. PRBODY # Add dynamic content @@ -672,10 +670,10 @@ jobs: echo "[WARN] Failed to create pull request (exit code: ${PR_EXIT_CODE})" >&2 echo "[WARN] Output: ${PR_OUTPUT}" >&2 - # Check for common error conditions - if echo "${PR_OUTPUT}" | grep -iq "already exists"; then - echo "[INFO] PR likely already exists, continuing..." >&2 - elif echo "${PR_OUTPUT}" | grep -iq "no commits between"; then + # Check for common error conditions with specific patterns + if echo "${PR_OUTPUT}" | grep -iqE "pull request.*already exists"; then + echo "[INFO] PR already exists, continuing..." >&2 + elif echo "${PR_OUTPUT}" | grep -iqE "no commits between.*branch"; then echo "[INFO] No commits between branches, continuing..." >&2 else echo "[WARN] Unexpected error occurred, but continuing workflow" >&2