@@ -66,24 +66,76 @@ jobs:
6666 permission-contents : ' write'
6767
6868 - name : ' Create Patch for Stable'
69+ id : ' create_patch_stable'
6970 if : " github.event.inputs.channel == 'stable'"
7071 env :
7172 GH_TOKEN : ' ${{ steps.generate_token.outputs.token }}'
72- run : ' node scripts/create-patch-pr.js --commit=${{ github.event.inputs.commit }} --channel=stable --dry-run=${{ github.event.inputs.dry_run }}'
73+ continue-on-error : true
74+ run : |
75+ node scripts/create-patch-pr.js --commit=${{ github.event.inputs.commit }} --channel=stable --dry-run=${{ github.event.inputs.dry_run }} > patch_output.log 2>&1
76+ echo "EXIT_CODE=$?" >> "$GITHUB_OUTPUT"
77+ cat patch_output.log
7378
7479 - name : ' Create Patch for Preview'
75- id : ' create_patch'
80+ id : ' create_patch_preview'
81+ if : " github.event.inputs.channel != 'stable'"
7682 env :
7783 GH_TOKEN : ' ${{ steps.generate_token.outputs.token }}'
78- run : ' node scripts/create-patch-pr.js --commit=${{ github.event.inputs.commit }} --channel=${{ github.event.inputs.channel }} --dry-run=${{ github.event.inputs.dry_run }}'
84+ continue-on-error : true
85+ run : |
86+ node scripts/create-patch-pr.js --commit=${{ github.event.inputs.commit }} --channel=${{ github.event.inputs.channel }} --dry-run=${{ github.event.inputs.dry_run }} > patch_output.log 2>&1
87+ echo "EXIT_CODE=$?" >> "$GITHUB_OUTPUT"
88+ cat patch_output.log
7989
8090 - name : ' Comment on Original PR'
8191 if : ' !inputs.dry_run && inputs.original_pr'
8292 env :
8393 GH_TOKEN : ' ${{ steps.generate_token.outputs.token }}'
8494 run : |
85- gh pr comment ${{ github.event.inputs.original_pr }} --body "🚀 Patch PR created!
95+ # Determine which step ran based on channel
96+ if [ "${{ github.event.inputs.channel }}" = "stable" ]; then
97+ EXIT_CODE="${{ steps.create_patch_stable.outputs.EXIT_CODE }}"
98+ else
99+ EXIT_CODE="${{ steps.create_patch_preview.outputs.EXIT_CODE }}"
100+ fi
101+
102+ # Check if patch output exists and contains branch info
103+ if [ -f patch_output.log ]; then
104+ if grep -q "already exists" patch_output.log && grep -q "already contains commit" patch_output.log; then
105+ # Branch exists and has the commit
106+ BRANCH=$(grep "Hotfix branch" patch_output.log | grep "already exists" | sed 's/.*Hotfix branch \(.*\) already exists.*/\1/')
107+ gh pr comment ${{ github.event.inputs.original_pr }} --body "ℹ️ Patch branch already exists!
108+
109+ The commit is already included in the existing patch branch: \`$BRANCH\`
110+
111+ Check if there's already a PR for this patch: https://github.com/${{ github.repository }}/pulls?q=is%3Apr+is%3Aopen+head%3A$BRANCH"
112+
113+ elif grep -q "already exists" patch_output.log; then
114+ # Branch exists but doesn't have the commit
115+ BRANCH=$(grep "Hotfix branch" patch_output.log | grep "already exists" | sed 's/.*Hotfix branch \(.*\) already exists.*/\1/')
116+ gh pr comment ${{ github.event.inputs.original_pr }} --body "⚠️ Patch branch exists but needs update!
117+
118+ A patch branch \`$BRANCH\` exists but doesn't contain this commit. You may need to manually handle this conflict.
119+
120+ View the existing branch: https://github.com/${{ github.repository }}/tree/$BRANCH"
121+
122+ elif [ "$EXIT_CODE" = "0" ]; then
123+ # Success - new branch created
124+ gh pr comment ${{ github.event.inputs.original_pr }} --body "🚀 Patch PR created!
125+
126+ The patch release PR for this change has been created. Please review and approve it to complete the patch release:
127+
128+ View all patch PRs: https://github.com/${{ github.repository }}/pulls?q=is%3Apr+is%3Aopen+label%3Apatch"
129+ else
130+ # Other error
131+ gh pr comment ${{ github.event.inputs.original_pr }} --body "❌ Patch creation failed!
86132
87- The patch release PR for this change has been created. Please review and approve it to complete the patch release:
133+ There was an error creating the patch. Please check the workflow logs for details:
134+ https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
135+ fi
136+ else
137+ gh pr comment ${{ github.event.inputs.original_pr }} --body "❌ Patch creation failed!
88138
89- View all patch PRs: https://github.com/${{ github.repository }}/pulls?q=is%3Apr+is%3Aopen+label%3Apatch"
139+ No output was generated. Please check the workflow logs:
140+ https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
141+ fi
0 commit comments