|
50 | 50 | git status --porcelain |
51 | 51 | fi |
52 | 52 |
|
53 | | - - name: Commit version & changelog changes into prep branch |
| 53 | + - name: Commit version & changelog directly into release branch |
54 | 54 | if: steps.changes.outputs.has_changes == 'true' |
55 | 55 | uses: stefanzweifel/git-auto-commit-action@v5 |
56 | 56 | env: |
|
59 | 59 | commit_message: "chore: version packages (prepare release)" |
60 | 60 | commit_user_name: github-actions[bot] |
61 | 61 | commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com |
62 | | - branch: changeset/prepare-${{ github.ref_name }} |
63 | | - create_branch: true |
| 62 | + branch: ${{ github.ref_name }} |
| 63 | + create_branch: false |
64 | 64 | push_options: --force-with-lease |
65 | 65 |
|
66 | | - - name: Open or update PR to release branch |
67 | | - if: steps.changes.outputs.has_changes == 'true' |
68 | | - uses: actions/github-script@v7 |
69 | | - with: |
70 | | - script: | |
71 | | - const { owner, repo } = context.repo; |
72 | | - const releaseBranch = context.ref.replace('refs/heads/', ''); |
73 | | - const headBranch = `changeset/prepare-${releaseBranch}`; |
74 | | - const base = releaseBranch; |
75 | | - const title = 'chore: release (prepared by Changesets)'; |
76 | | - const body = 'This PR was automatically created by release-prepare workflow. It contains version bumps and CHANGELOG updates generated by Changesets.'; |
77 | | -
|
78 | | - const existing = await github.rest.pulls.list({ owner, repo, state: 'open', head: `${owner}:${headBranch}`, base }); |
79 | | - if (existing.data.length > 0) { |
80 | | - const pr = existing.data[0]; |
81 | | - await github.rest.pulls.update({ owner, repo, pull_number: pr.number, title, body }); |
82 | | - core.info(`Updated PR #${pr.number}: ${pr.html_url}`); |
83 | | - return; |
84 | | - } |
85 | | -
|
86 | | - try { |
87 | | - const cmp = await github.rest.repos.compareCommits({ owner, repo, base, head: headBranch }); |
88 | | - if (!cmp.data.ahead_by) { |
89 | | - core.info(`No commits ahead in ${headBranch} vs ${base}. Skipping PR creation.`); |
90 | | - return; |
91 | | - } |
92 | | - } catch (e) { |
93 | | - core.info(`compareCommits failed: ${e.message}`); |
94 | | - } |
95 | | -
|
96 | | - const pr = await github.rest.pulls.create({ owner, repo, head: headBranch, base, title, body }); |
97 | | - core.info(`Created PR #${pr.data.number}: ${pr.data.html_url}`); |
0 commit comments