Skip to content
Merged

Prstep2 #8715

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions .github/workflows/release-patch-1-create-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,41 +101,35 @@ jobs:

# Check if patch output exists and contains branch info
if [ -f patch_output.log ]; then
if grep -q "already exists" patch_output.log && grep -q "already contains commit" patch_output.log; then
# Branch exists and has the commit
if grep -q "already exists" patch_output.log; then
# Branch exists - let user review
BRANCH=$(grep "Hotfix branch" patch_output.log | grep "already exists" | sed 's/.*Hotfix branch \(.*\) already exists.*/\1/')
gh pr comment ${{ github.event.inputs.original_pr }} --body "ℹ️ Patch branch already exists!

The commit is already included in the existing patch branch: \`$BRANCH\`
A patch branch already exists: [\`$BRANCH\`](https://github.com/${{ github.repository }}/tree/$BRANCH)

Check if there's already a PR for this patch: https://github.com/${{ github.repository }}/pulls?q=is%3Apr+is%3Aopen+head%3A$BRANCH"
Please review this existing branch. If it's correct, check for an existing PR:
[View patch PRs for this branch](https://github.com/${{ github.repository }}/pulls?q=is%3Apr+head%3A$BRANCH)

elif grep -q "already exists" patch_output.log; then
# Branch exists but doesn't have the commit
BRANCH=$(grep "Hotfix branch" patch_output.log | grep "already exists" | sed 's/.*Hotfix branch \(.*\) already exists.*/\1/')
gh pr comment ${{ github.event.inputs.original_pr }} --body "⚠️ Patch branch exists but needs update!

A patch branch \`$BRANCH\` exists but doesn't contain this commit. You may need to manually handle this conflict.

View the existing branch: https://github.com/${{ github.repository }}/tree/$BRANCH"
If the branch is incorrect or outdated, please delete it manually and run the patch command again."

elif [ "$EXIT_CODE" = "0" ]; then
# Success - new branch created
gh pr comment ${{ github.event.inputs.original_pr }} --body "πŸš€ Patch PR created!

The patch release PR for this change has been created. Please review and approve it to complete the patch release:

View all patch PRs: https://github.com/${{ github.repository }}/pulls?q=is%3Apr+is%3Aopen+label%3Apatch"
[View all patch PRs](https://github.com/${{ github.repository }}/pulls?q=is%3Apr+is%3Aopen+label%3Apatch)"
else
# Other error
gh pr comment ${{ github.event.inputs.original_pr }} --body "❌ Patch creation failed!

There was an error creating the patch. Please check the workflow logs for details:
https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
[View workflow run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})"
fi
else
gh pr comment ${{ github.event.inputs.original_pr }} --body "❌ Patch creation failed!

No output was generated. Please check the workflow logs:
https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
[View workflow run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})"
fi
17 changes: 1 addition & 16 deletions scripts/create-patch-pr.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,7 @@ async function main() {
// Check if hotfix branch already exists
if (branchExists(hotfixBranch)) {
console.log(`Hotfix branch ${hotfixBranch} already exists.`);

// Check if the existing branch already has this commit
const hasCommit = run(
`git branch --contains ${commit} | grep ${hotfixBranch}`,
dryRun,
false,
);
if (hasCommit) {
console.log(`Branch ${hotfixBranch} already contains commit ${commit}.`);
return { existingBranch: hotfixBranch, hasCommit: true };
} else {
console.log(
`Branch ${hotfixBranch} exists but doesn't contain commit ${commit}.`,
);
return { existingBranch: hotfixBranch, hasCommit: false };
}
return { existingBranch: hotfixBranch };
}

// Create the hotfix branch from the release branch.
Expand Down
Loading