Skip to content

Commit 99b43e1

Browse files
authored
Prstep2 (#8715)
1 parent 6b34f38 commit 99b43e1

File tree

2 files changed

+10
-31
lines changed

2 files changed

+10
-31
lines changed

.github/workflows/release-patch-1-create-pr.yml

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -101,41 +101,35 @@ jobs:
101101
102102
# Check if patch output exists and contains branch info
103103
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
104+
if grep -q "already exists" patch_output.log; then
105+
# Branch exists - let user review
106106
BRANCH=$(grep "Hotfix branch" patch_output.log | grep "already exists" | sed 's/.*Hotfix branch \(.*\) already exists.*/\1/')
107107
gh pr comment ${{ github.event.inputs.original_pr }} --body "ℹ️ Patch branch already exists!
108108
109-
The commit is already included in the existing patch branch: \`$BRANCH\`
109+
A patch branch already exists: [\`$BRANCH\`](https://github.com/${{ github.repository }}/tree/$BRANCH)
110110
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"
111+
Please review this existing branch. If it's correct, check for an existing PR:
112+
[View patch PRs for this branch](https://github.com/${{ github.repository }}/pulls?q=is%3Apr+head%3A$BRANCH)
112113
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"
114+
If the branch is incorrect or outdated, please delete it manually and run the patch command again."
121115
122116
elif [ "$EXIT_CODE" = "0" ]; then
123117
# Success - new branch created
124118
gh pr comment ${{ github.event.inputs.original_pr }} --body "🚀 Patch PR created!
125119
126120
The patch release PR for this change has been created. Please review and approve it to complete the patch release:
127121
128-
View all patch PRs: https://github.com/${{ github.repository }}/pulls?q=is%3Apr+is%3Aopen+label%3Apatch"
122+
[View all patch PRs](https://github.com/${{ github.repository }}/pulls?q=is%3Apr+is%3Aopen+label%3Apatch)"
129123
else
130124
# Other error
131125
gh pr comment ${{ github.event.inputs.original_pr }} --body "❌ Patch creation failed!
132126
133127
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 }}"
128+
[View workflow run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})"
135129
fi
136130
else
137131
gh pr comment ${{ github.event.inputs.original_pr }} --body "❌ Patch creation failed!
138132
139133
No output was generated. Please check the workflow logs:
140-
https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
134+
[View workflow run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})"
141135
fi

scripts/create-patch-pr.js

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,22 +62,7 @@ async function main() {
6262
// Check if hotfix branch already exists
6363
if (branchExists(hotfixBranch)) {
6464
console.log(`Hotfix branch ${hotfixBranch} already exists.`);
65-
66-
// Check if the existing branch already has this commit
67-
const hasCommit = run(
68-
`git branch --contains ${commit} | grep ${hotfixBranch}`,
69-
dryRun,
70-
false,
71-
);
72-
if (hasCommit) {
73-
console.log(`Branch ${hotfixBranch} already contains commit ${commit}.`);
74-
return { existingBranch: hotfixBranch, hasCommit: true };
75-
} else {
76-
console.log(
77-
`Branch ${hotfixBranch} exists but doesn't contain commit ${commit}.`,
78-
);
79-
return { existingBranch: hotfixBranch, hasCommit: false };
80-
}
65+
return { existingBranch: hotfixBranch };
8166
}
8267

8368
// Create the hotfix branch from the release branch.

0 commit comments

Comments
 (0)