From 2b0e6e8fa83d497995e45b8c85152d024c842491 Mon Sep 17 00:00:00 2001 From: gitclonebrian <235774926+gitclonebrian@users.noreply.github.com> Date: Mon, 20 Apr 2026 17:09:48 -0400 Subject: [PATCH 1/9] added intermediate PR step to cpick workflow --- .github/workflows/_cherry-pick.yml | 58 +++++++++++++++++++++++++++--- cherry-pick/cherry-pick.yml | 6 ++++ 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/.github/workflows/_cherry-pick.yml b/.github/workflows/_cherry-pick.yml index f1e28051a..ae3a151fc 100644 --- a/.github/workflows/_cherry-pick.yml +++ b/.github/workflows/_cherry-pick.yml @@ -16,6 +16,11 @@ on: required: false type: string default: '' + create_pr: + description: 'Create a PR to dest_branch instead of pushing directly' + required: false + type: boolean + default: false test_mode: description: 'Run in test mode (skips Azure auth and GPG signing)' required: false @@ -38,6 +43,7 @@ jobs: _SOURCE_PR: ${{ inputs.source_pr }} _DEST_BRANCH: ${{ inputs.dest_branch }} _DEST_BRANCH_ALLOWED: ${{ inputs.dest_branch_allowed }} + _CHERRY_PICK_BRANCH: cherry-pick/${{ inputs.source_pr }}-to-${{ inputs.dest_branch }} runs-on: ubuntu-24.04 permissions: contents: write @@ -105,7 +111,7 @@ jobs: WORKFLOW_REF: ${{ github.workflow_ref }} run: | # get PR info - if ! pr_info=$(gh pr view "$_SOURCE_PR" --json state,baseRefName,mergeCommit); then + if ! pr_info=$(gh pr view "$_SOURCE_PR" --json state,baseRefName,mergeCommit,title); then echo "ERROR: Could not gather data for PR [#$_SOURCE_PR]. Please verify the number." exit 1 fi @@ -113,10 +119,12 @@ jobs: pr_state=$(echo "$pr_info" | jq -r .state) pr_base_ref=$(echo "$pr_info" | jq -r .baseRefName) pr_commit=$(echo "$pr_info" | jq -r .mergeCommit.oid) + pr_title=$(echo "$pr_info" | jq -r .title) echo "INFO: PR state: [$pr_state]" echo "INFO: PR base ref: [$pr_base_ref]" echo "INFO: PR commit: [$pr_commit]" + echo "INFO: PR title: [$pr_title]" echo "INFO: Calling workflow: [$WORKFLOW_REF]" # if this is being run by the test-cherry-pick workflow, allow picking from the simulated main branch @@ -144,6 +152,7 @@ jobs: fi echo "pr_commit=$pr_commit" >> $GITHUB_OUTPUT + echo "pr_title=$pr_title" >> $GITHUB_OUTPUT - name: Checkout dest branch uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 @@ -153,6 +162,12 @@ jobs: persist-credentials: true fetch-depth: 0 + - name: Create cherry-pick branch + if: inputs.create_pr + run: | + git checkout -b "$_CHERRY_PICK_BRANCH" + echo "INFO: Created branch [$_CHERRY_PICK_BRANCH] from [$_DEST_BRANCH]" + - name: Configure git run: | git config --local user.name "bitwarden-devops-bot" @@ -161,9 +176,8 @@ jobs: - name: Cherry pick env: PR_COMMIT: ${{ steps.validate-pr.outputs.pr_commit }} - GH_TOKEN: ${{ inputs.test_mode && github.token || steps.app-token.outputs.token }} run: | - echo "INFO: Cherry-picking commit [$PR_COMMIT] from PR [#$_SOURCE_PR] to branch [$_DEST_BRANCH]" + echo "INFO: Cherry-picking commit [$PR_COMMIT] from PR [#$_SOURCE_PR]" if ! git cherry-pick -x "$PR_COMMIT"; then echo "ERROR: Cherry-pick failed for commit [$PR_COMMIT]" git cherry-pick --abort @@ -171,6 +185,11 @@ jobs: fi echo 'INFO: Cherry pick successful!' + - name: Push to destination branch + if: ${{ !inputs.create_pr }} + env: + GH_TOKEN: ${{ inputs.test_mode && github.token || steps.app-token.outputs.token }} + run: | echo "INFO: Pushing local [$_DEST_BRANCH] branch to origin" if ! git push origin "$_DEST_BRANCH"; then echo "ERROR: Failed to push to origin." @@ -184,7 +203,38 @@ jobs: run_url="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" echo "INFO: Adding comment to PR [#$_SOURCE_PR]" - if ! gh pr comment "$_SOURCE_PR" --body "✅ Successfully cherry-picked to \`$_DEST_BRANCH\`. [View run]($run_url)"; then + if ! gh pr comment "$_SOURCE_PR" --body "✅ Successfully cherry-picked to [$_DEST_BRANCH]. [View run]($run_url)"; then + echo "WARN: Failed to add comment to PR [#$_SOURCE_PR]" + fi + + - name: Push branch and open PR + if: inputs.create_pr + env: + GH_TOKEN: ${{ inputs.test_mode && github.token || steps.app-token.outputs.token }} + PR_TITLE: ${{ steps.validate-pr.outputs.pr_title }} + run: | + echo "INFO: Pushing branch [$_CHERRY_PICK_BRANCH] to origin" + if ! git push origin "$_CHERRY_PICK_BRANCH"; then + echo "ERROR: Failed to push branch [$_CHERRY_PICK_BRANCH]." + exit 1 + fi + + run_url="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" + + PR_BODY="🍒 Automated cherry-pick of PR [#$_SOURCE_PR] to [$_DEST_BRANCH]. [View run]($run_url)" + + if ! new_pr_url=$(gh pr create \ + --base "$_DEST_BRANCH" \ + --head "$_CHERRY_PICK_BRANCH" \ + --title "Cherry pick: $PR_TITLE" \ + --body "$PR_BODY"); then + echo "ERROR: Failed to create PR." + exit 1 + fi + + echo "INFO: Cherry-pick PR created: [$new_pr_url]" + + if ! gh pr comment "$_SOURCE_PR" --body "🍒 Cherry-pick PR created targeting [$_DEST_BRANCH]: $new_pr_url. [View run]($run_url)"; then echo "WARN: Failed to add comment to PR [#$_SOURCE_PR]" fi diff --git a/cherry-pick/cherry-pick.yml b/cherry-pick/cherry-pick.yml index 6d705081d..be07ba030 100644 --- a/cherry-pick/cherry-pick.yml +++ b/cherry-pick/cherry-pick.yml @@ -16,6 +16,11 @@ on: - rc - hotfix-rc - rc-2024-02 + create_pr: + description: 'Create a PR to dest_branch instead of pushing directly' + required: false + type: boolean + default: false # It's also possible to provide `dest_branch` as a free-form string input # dest_branch: @@ -35,6 +40,7 @@ jobs: # Optionally validate `dest_branch` by providing an extended regex expression (ERE) pattern that `dest_branch` must match. Leave empty ('') to disable. # dest_branch_allowed: '^20[2-9][0-9]\.[0-9][0-9]\-rc[0-9]$' # matches format `2025.01-rc2` dest_branch_allowed: '' + create_pr: ${{ inputs.create_pr }} permissions: contents: read id-token: write From ec720bfc48dca3cb742ee2aa43540ba6d5fe254e Mon Sep 17 00:00:00 2001 From: gitclonebrian <235774926+gitclonebrian@users.noreply.github.com> Date: Tue, 21 Apr 2026 11:07:38 -0400 Subject: [PATCH 2/9] added temporary sleep to cleanup job so i can review the created resources --- .github/workflows/test-cherry-pick.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-cherry-pick.yml b/.github/workflows/test-cherry-pick.yml index f91b030df..158c0e4b7 100644 --- a/.github/workflows/test-cherry-pick.yml +++ b/.github/workflows/test-cherry-pick.yml @@ -128,6 +128,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | + sleep 120 if [[ -n $_SIMULATED_PR_NUMBER ]]; then pr_state=$(gh pr view "$_SIMULATED_PR_NUMBER" --json state --jq '.state') if [[ $pr_state == 'OPEN' ]]; then From 80b1dcd562699f6e6aefdc74b3442272a6564900 Mon Sep 17 00:00:00 2001 From: gitclonebrian <235774926+gitclonebrian@users.noreply.github.com> Date: Tue, 21 Apr 2026 11:10:52 -0400 Subject: [PATCH 3/9] added PR URL to step summary --- .github/workflows/_cherry-pick.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/_cherry-pick.yml b/.github/workflows/_cherry-pick.yml index ae3a151fc..2ed097ff9 100644 --- a/.github/workflows/_cherry-pick.yml +++ b/.github/workflows/_cherry-pick.yml @@ -238,4 +238,4 @@ jobs: echo "WARN: Failed to add comment to PR [#$_SOURCE_PR]" fi - + echo "🍒 Cherry-pick PR created: $new_pr_url." >> $GITHUB_STEP_SUMMARY From 59f888c0a3ed9b034ad3da9dea9432588997a3c9 Mon Sep 17 00:00:00 2001 From: gitclonebrian <235774926+gitclonebrian@users.noreply.github.com> Date: Tue, 21 Apr 2026 11:26:37 -0400 Subject: [PATCH 4/9] added test of workflow in PR mode to test workflow --- .github/workflows/test-cherry-pick.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/test-cherry-pick.yml b/.github/workflows/test-cherry-pick.yml index 158c0e4b7..387596d18 100644 --- a/.github/workflows/test-cherry-pick.yml +++ b/.github/workflows/test-cherry-pick.yml @@ -103,6 +103,22 @@ jobs: contents: write pull-requests: write id-token: write + + cherry-pick-pr: + # Call the cherry-pick.yml workflow in PR mode and pass in the simulated branches and PR. + name: Cherry-pick + needs: setup + uses: ./.github/workflows/_cherry-pick.yml + with: + source_pr: ${{ needs.setup.outputs.simulated_pr_number }} + dest_branch: ${{ needs.setup.outputs.simulated_dest_branch }} + dest_branch_allowed: '^cherry-pick-sim-dest-[0-9]{10}$' + test_mode: true + create_pr: true + permissions: + contents: write + pull-requests: write + id-token: write cleanup: # Cleanup all the simulated resources From 1a768b602b7ba523cb8b3114ec1bd531e5fbf89b Mon Sep 17 00:00:00 2001 From: gitclonebrian <235774926+gitclonebrian@users.noreply.github.com> Date: Tue, 21 Apr 2026 12:02:52 -0400 Subject: [PATCH 5/9] added cleanup of new branch when running in PR mode --- .github/workflows/_cherry-pick.yml | 8 ++++++++ .github/workflows/test-cherry-pick.yml | 18 +++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/_cherry-pick.yml b/.github/workflows/_cherry-pick.yml index 2ed097ff9..a8f38f9a5 100644 --- a/.github/workflows/_cherry-pick.yml +++ b/.github/workflows/_cherry-pick.yml @@ -26,6 +26,10 @@ on: required: false type: boolean default: false + outputs: + cherry_pick_branch: + description: 'The cherry-pick branch created when create_pr is true, empty otherwise' + value: ${{ jobs.cherry-pick.outputs.cherry_pick_branch }} secrets: AZURE_SUBSCRIPTION_ID: required: false @@ -39,6 +43,8 @@ permissions: {} jobs: cherry-pick: name: Cherry Pick Commit + outputs: + cherry_pick_branch: ${{ steps.create-cherry-pick-branch.outputs.cherry_pick_branch }} env: _SOURCE_PR: ${{ inputs.source_pr }} _DEST_BRANCH: ${{ inputs.dest_branch }} @@ -164,9 +170,11 @@ jobs: - name: Create cherry-pick branch if: inputs.create_pr + id: create-cherry-pick-branch run: | git checkout -b "$_CHERRY_PICK_BRANCH" echo "INFO: Created branch [$_CHERRY_PICK_BRANCH] from [$_DEST_BRANCH]" + echo "cherry_pick_branch=$_CHERRY_PICK_BRANCH" >> $GITHUB_OUTPUT - name: Configure git run: | diff --git a/.github/workflows/test-cherry-pick.yml b/.github/workflows/test-cherry-pick.yml index 387596d18..ee2f5be50 100644 --- a/.github/workflows/test-cherry-pick.yml +++ b/.github/workflows/test-cherry-pick.yml @@ -106,8 +106,8 @@ jobs: cherry-pick-pr: # Call the cherry-pick.yml workflow in PR mode and pass in the simulated branches and PR. - name: Cherry-pick - needs: setup + name: Cherry-pick-pr + needs: [setup, cherry-pick] uses: ./.github/workflows/_cherry-pick.yml with: source_pr: ${{ needs.setup.outputs.simulated_pr_number }} @@ -124,13 +124,14 @@ jobs: # Cleanup all the simulated resources name: Cleanup Simulated Resources runs-on: ubuntu-24.04 - needs: [setup, cherry-pick] + needs: [setup, cherry-pick-pr] if: always() env: _SIMULATED_MAIN_BRANCH: ${{ needs.setup.outputs.simulated_main_branch }} _SIMULATED_FEATURE_BRANCH: ${{ needs.setup.outputs.simulated_feature_branch }} _SIMULATED_DEST_BRANCH: ${{ needs.setup.outputs.simulated_dest_branch }} _SIMULATED_PR_NUMBER: ${{ needs.setup.outputs.simulated_pr_number }} + _CHERRY_PICK_BRANCH: ${{ needs.cherry-pick-pr.outputs.cherry_pick_branch }} permissions: contents: write pull-requests: write @@ -177,6 +178,17 @@ jobs: fi fi + if [[ -n $_CHERRY_PICK_BRANCH ]]; then + if git ls-remote --exit-code --heads origin "$_CHERRY_PICK_BRANCH" >/dev/null 2>&1; then + echo "INFO: Deleting cherry-pick branch [$_CHERRY_PICK_BRANCH]" + if ! git push origin --delete "$_CHERRY_PICK_BRANCH"; then + echo "WARN: Failed to delete [$_CHERRY_PICK_BRANCH] branch. Please manually delete this." + fi + else + echo "INFO: Branch [$_CHERRY_PICK_BRANCH] does not exist or was already deleted." + fi + fi + if [[ -n $_SIMULATED_DEST_BRANCH ]]; then if git ls-remote --exit-code --heads origin "$_SIMULATED_DEST_BRANCH" >/dev/null 2>&1; then echo "INFO: Deleting simulated destination branch [$_SIMULATED_DEST_BRANCH]" From 68515c71ed6c65a038814298ed055b07a9b3ab98 Mon Sep 17 00:00:00 2001 From: gitclonebrian <235774926+gitclonebrian@users.noreply.github.com> Date: Tue, 21 Apr 2026 12:12:29 -0400 Subject: [PATCH 6/9] swapped order of test modes so the test cpick doesnt interfere with the PR in PR mode --- .github/workflows/test-cherry-pick.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-cherry-pick.yml b/.github/workflows/test-cherry-pick.yml index ee2f5be50..03487297c 100644 --- a/.github/workflows/test-cherry-pick.yml +++ b/.github/workflows/test-cherry-pick.yml @@ -89,9 +89,9 @@ jobs: fi - cherry-pick: - # Call the cherry-pick.yml workflow and pass in the simulated branches and PR. - name: Cherry-pick + cherry-pick-pr: + # Call the cherry-pick.yml workflow in PR mode and pass in the simulated branches and PR. + name: Cherry-pick-pr needs: setup uses: ./.github/workflows/_cherry-pick.yml with: @@ -99,22 +99,22 @@ jobs: dest_branch: ${{ needs.setup.outputs.simulated_dest_branch }} dest_branch_allowed: '^cherry-pick-sim-dest-[0-9]{10}$' test_mode: true + create_pr: true permissions: contents: write pull-requests: write id-token: write - - cherry-pick-pr: - # Call the cherry-pick.yml workflow in PR mode and pass in the simulated branches and PR. - name: Cherry-pick-pr - needs: [setup, cherry-pick] + + cherry-pick: + # Call the cherry-pick.yml workflow and pass in the simulated branches and PR. + name: Cherry-pick + needs: [setup, cherry-pick-pr] uses: ./.github/workflows/_cherry-pick.yml with: source_pr: ${{ needs.setup.outputs.simulated_pr_number }} dest_branch: ${{ needs.setup.outputs.simulated_dest_branch }} dest_branch_allowed: '^cherry-pick-sim-dest-[0-9]{10}$' test_mode: true - create_pr: true permissions: contents: write pull-requests: write @@ -124,7 +124,7 @@ jobs: # Cleanup all the simulated resources name: Cleanup Simulated Resources runs-on: ubuntu-24.04 - needs: [setup, cherry-pick-pr] + needs: [setup, cherry-pick] if: always() env: _SIMULATED_MAIN_BRANCH: ${{ needs.setup.outputs.simulated_main_branch }} From 0ad577842726621a8479ccaee89807c20af3e35d Mon Sep 17 00:00:00 2001 From: gitclonebrian <235774926+gitclonebrian@users.noreply.github.com> Date: Tue, 21 Apr 2026 12:22:59 -0400 Subject: [PATCH 7/9] added needs to cleanup so it can access the step output --- .github/workflows/test-cherry-pick.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-cherry-pick.yml b/.github/workflows/test-cherry-pick.yml index 03487297c..1f79dfe10 100644 --- a/.github/workflows/test-cherry-pick.yml +++ b/.github/workflows/test-cherry-pick.yml @@ -124,7 +124,7 @@ jobs: # Cleanup all the simulated resources name: Cleanup Simulated Resources runs-on: ubuntu-24.04 - needs: [setup, cherry-pick] + needs: [setup, cherry-pick-pr, cherry-pick] if: always() env: _SIMULATED_MAIN_BRANCH: ${{ needs.setup.outputs.simulated_main_branch }} From c2cdde3ce2d02d7d692bba2ddab84edf9dccff82 Mon Sep 17 00:00:00 2001 From: gitclonebrian <235774926+gitclonebrian@users.noreply.github.com> Date: Thu, 21 May 2026 15:43:10 -0400 Subject: [PATCH 8/9] reformatted error messages --- .github/workflows/_cherry-pick.yml | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/_cherry-pick.yml b/.github/workflows/_cherry-pick.yml index a8f38f9a5..bed8a350b 100644 --- a/.github/workflows/_cherry-pick.yml +++ b/.github/workflows/_cherry-pick.yml @@ -22,7 +22,7 @@ on: type: boolean default: false test_mode: - description: 'Run in test mode (skips Azure auth and GPG signing)' + description: 'Run in test mode (skips Azure auth and uses local token)' required: false type: boolean default: false @@ -60,7 +60,7 @@ jobs: if: inputs.dest_branch_allowed != '' run: | if ! echo "$_DEST_BRANCH" | grep -Eq "$_DEST_BRANCH_ALLOWED"; then - echo "ERROR: Destination branch [$_DEST_BRANCH] does not match allowed pattern [$_DEST_BRANCH_ALLOWED]" + echo "::error::Destination branch [$_DEST_BRANCH] does not match allowed pattern [$_DEST_BRANCH_ALLOWED]" exit 1 fi echo "INFO: Destination branch matches allowed pattern" @@ -106,7 +106,7 @@ jobs: id: validate_dest_branch run: | if ! git rev-parse --quiet --verify origin/"$_DEST_BRANCH" >/dev/null; then - echo "ERROR: Could not find destination branch [$_DEST_BRANCH]. Please confirm the branch exists and the name is correct." + echo "::error::Could not find destination branch [$_DEST_BRANCH]. Please confirm the branch exists and the name is correct." exit 1 fi @@ -118,7 +118,7 @@ jobs: run: | # get PR info if ! pr_info=$(gh pr view "$_SOURCE_PR" --json state,baseRefName,mergeCommit,title); then - echo "ERROR: Could not gather data for PR [#$_SOURCE_PR]. Please verify the number." + echo "::error::Could not gather data for PR [#$_SOURCE_PR]. Please verify the number." exit 1 fi @@ -137,23 +137,23 @@ jobs: if [[ $WORKFLOW_REF == bitwarden/gh-actions/.github/workflows/test-cherry-pick.yml@* ]]; then echo "INFO: This workflow is being run by the [test-cherry-pick.yml] workflow." if [[ ${pr_base_ref:0:21} != "cherry-pick-sim-main-" ]]; then - echo "ERROR: Invalid test base ref: [$pr_base_ref]. Test ref/branch must match [cherry-pick-sim-main-*]" + echo "::error::Invalid test base ref: [$pr_base_ref]. Test ref/branch must match [cherry-pick-sim-main-*]" exit 1 fi else if [[ $pr_base_ref != 'main' ]]; then - echo "ERROR: Invalid PR base ref: [$pr_base_ref]. Base ref/branch must be [main]." + echo "::error::Invalid PR base ref: [$pr_base_ref]. Base ref/branch must be [main]." exit 1 fi fi if [[ $pr_state != 'MERGED' ]]; then - echo "ERROR: Invalid PR state: [$pr_state]. State must be [MERGED]." + echo "::error::Invalid PR state: [$pr_state]. State must be [MERGED]." exit 1 fi if [[ -z $pr_commit ]]; then - echo "ERROR: GitHub API returned empty commit for PR. Cannot continue." + echo "::error::GitHub API returned empty commit for PR. Cannot continue." exit 1 fi @@ -187,7 +187,7 @@ jobs: run: | echo "INFO: Cherry-picking commit [$PR_COMMIT] from PR [#$_SOURCE_PR]" if ! git cherry-pick -x "$PR_COMMIT"; then - echo "ERROR: Cherry-pick failed for commit [$PR_COMMIT]" + echo "::error::Cherry-pick failed for commit [$PR_COMMIT]" git cherry-pick --abort exit 1 fi @@ -200,19 +200,19 @@ jobs: run: | echo "INFO: Pushing local [$_DEST_BRANCH] branch to origin" if ! git push origin "$_DEST_BRANCH"; then - echo "ERROR: Failed to push to origin." + echo "::error::Failed to push to origin." exit 1 fi echo "INFO: Adding 'cherry-picked' label to PR [#$_SOURCE_PR]" if ! gh pr edit "$_SOURCE_PR" --add-label "cherry-picked"; then - echo "WARN: Failed to add label to PR [#$_SOURCE_PR]" + echo "::warning::Failed to add label to PR [#$_SOURCE_PR]" fi run_url="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" echo "INFO: Adding comment to PR [#$_SOURCE_PR]" if ! gh pr comment "$_SOURCE_PR" --body "✅ Successfully cherry-picked to [$_DEST_BRANCH]. [View run]($run_url)"; then - echo "WARN: Failed to add comment to PR [#$_SOURCE_PR]" + echo "::warning::Failed to add comment to PR [#$_SOURCE_PR]" fi - name: Push branch and open PR @@ -223,7 +223,7 @@ jobs: run: | echo "INFO: Pushing branch [$_CHERRY_PICK_BRANCH] to origin" if ! git push origin "$_CHERRY_PICK_BRANCH"; then - echo "ERROR: Failed to push branch [$_CHERRY_PICK_BRANCH]." + echo "::error::Failed to push branch [$_CHERRY_PICK_BRANCH]." exit 1 fi @@ -236,14 +236,14 @@ jobs: --head "$_CHERRY_PICK_BRANCH" \ --title "Cherry pick: $PR_TITLE" \ --body "$PR_BODY"); then - echo "ERROR: Failed to create PR." + echo "::error::Failed to create PR." exit 1 fi echo "INFO: Cherry-pick PR created: [$new_pr_url]" if ! gh pr comment "$_SOURCE_PR" --body "🍒 Cherry-pick PR created targeting [$_DEST_BRANCH]: $new_pr_url. [View run]($run_url)"; then - echo "WARN: Failed to add comment to PR [#$_SOURCE_PR]" + echo "::warning::Failed to add comment to PR [#$_SOURCE_PR]" fi - echo "🍒 Cherry-pick PR created: $new_pr_url." >> $GITHUB_STEP_SUMMARY + echo "🍒 Cherry-pick PR created: [Here]($new_pr_url)." >> $GITHUB_STEP_SUMMARY From 3cd2e0ebb7779ee2235bb80658cacb83ae116a41 Mon Sep 17 00:00:00 2001 From: gitclonebrian <235774926+gitclonebrian@users.noreply.github.com> Date: Thu, 21 May 2026 15:46:04 -0400 Subject: [PATCH 9/9] reformatted error messages --- .github/workflows/test-cherry-pick.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test-cherry-pick.yml b/.github/workflows/test-cherry-pick.yml index 1f79dfe10..64a6c99fd 100644 --- a/.github/workflows/test-cherry-pick.yml +++ b/.github/workflows/test-cherry-pick.yml @@ -56,7 +56,7 @@ jobs: git add "$sim_branch.txt" git commit -m 'created test file' if ! git push origin "$sim_branch"; then - echo "ERROR: Failed to push [$sim_branch] branch to origin. Exiting." + echo "::error::Failed to push [$sim_branch] branch to origin. Exiting." exit 1 fi git switch main @@ -71,12 +71,12 @@ jobs: --body "Automated test PR for cherry-pick workflow testing. This should be cleaned up automatically and can safely be deleted if cleanup has failed." if [[ $? -ne 0 ]]; then - echo "ERROR: Failed to create PR from [$simulated_feature_branch] branch to [$simulated_main_branch]. Exiting" + echo "::error::Failed to create PR from [$simulated_feature_branch] branch to [$simulated_main_branch]. Exiting" exit 1 fi if ! simulated_pr_number=$(gh pr view "$simulated_feature_branch" --json number --jq '.number'); then - echo "ERROR: Failed to retrieve simulated PR number from [$simulated_feature_branch]. Exiting." + echo "::error::Failed to retrieve simulated PR number from [$simulated_feature_branch]. Exiting." exit 1 fi echo "simulated_pr_number=$simulated_pr_number" >> $GITHUB_OUTPUT @@ -84,7 +84,7 @@ jobs: echo "INFO: Merging PR [#$simulated_pr_number] into branch [$simulated_main_branch]" if ! gh pr merge "$simulated_pr_number" --squash; then - echo "ERROR: Failed to merge PR [#$simulated_pr_number]. Exiting." + echo "::error::Failed to merge PR [#$simulated_pr_number]. Exiting." exit 1 fi @@ -151,7 +151,7 @@ jobs: if [[ $pr_state == 'OPEN' ]]; then echo "INFO: Closing simulated PR [#$_SIMULATED_PR_NUMBER]" if ! gh pr close "$_SIMULATED_PR_NUMBER"; then - echo "WARN: Failed to close PR [#$_SIMULATED_PR_NUMBER]. Please manually delete these." + echo "::warning::Failed to close PR [#$_SIMULATED_PR_NUMBER]. Please manually delete these." fi fi fi @@ -160,7 +160,7 @@ jobs: if git ls-remote --exit-code --heads origin "$_SIMULATED_FEATURE_BRANCH" >/dev/null 2>&1; then echo "INFO: Deleting simulated feature branch [$_SIMULATED_FEATURE_BRANCH]" if ! git push origin --delete "$_SIMULATED_FEATURE_BRANCH"; then - echo "WARN: Failed to delete [$_SIMULATED_FEATURE_BRANCH] branch. Please manually delete this." + echo "::warning::Failed to delete [$_SIMULATED_FEATURE_BRANCH] branch. Please manually delete this." fi else echo "INFO: Branch [$_SIMULATED_FEATURE_BRANCH] does not exist or was already deleted." @@ -171,7 +171,7 @@ jobs: if git ls-remote --exit-code --heads origin "$_SIMULATED_MAIN_BRANCH" >/dev/null 2>&1; then echo "INFO: Deleting simulated main branch [$_SIMULATED_MAIN_BRANCH]" if ! git push origin --delete "$_SIMULATED_MAIN_BRANCH"; then - echo "WARN: Failed to delete [$_SIMULATED_MAIN_BRANCH] branch. Please manually delete this." + echo "::warning::Failed to delete [$_SIMULATED_MAIN_BRANCH] branch. Please manually delete this." fi else echo "INFO: Branch [$_SIMULATED_MAIN_BRANCH] does not exist or was already deleted." @@ -182,7 +182,7 @@ jobs: if git ls-remote --exit-code --heads origin "$_CHERRY_PICK_BRANCH" >/dev/null 2>&1; then echo "INFO: Deleting cherry-pick branch [$_CHERRY_PICK_BRANCH]" if ! git push origin --delete "$_CHERRY_PICK_BRANCH"; then - echo "WARN: Failed to delete [$_CHERRY_PICK_BRANCH] branch. Please manually delete this." + echo "::warning::Failed to delete [$_CHERRY_PICK_BRANCH] branch. Please manually delete this." fi else echo "INFO: Branch [$_CHERRY_PICK_BRANCH] does not exist or was already deleted." @@ -193,7 +193,7 @@ jobs: if git ls-remote --exit-code --heads origin "$_SIMULATED_DEST_BRANCH" >/dev/null 2>&1; then echo "INFO: Deleting simulated destination branch [$_SIMULATED_DEST_BRANCH]" if ! git push origin --delete "$_SIMULATED_DEST_BRANCH"; then - echo "WARN: Failed to delete [$_SIMULATED_DEST_BRANCH] branch. Please manually delete this." + echo "::warning::Failed to delete [$_SIMULATED_DEST_BRANCH] branch. Please manually delete this." fi else echo "INFO: Branch [$_SIMULATED_DEST_BRANCH] does not exist or was already deleted."