|
64 | 64 | git rev-parse HEAD |
65 | 65 | git rev-parse remotes/origin/main |
66 | 66 |
|
67 | | - # Produce human-readable Changesets status and expose it for the PR comment |
68 | | - - name: 📋 Show changeset status (since origin/main) |
69 | | - id: status |
70 | | - shell: bash |
71 | | - run: | |
72 | | - set -euo pipefail |
73 | | - npx changeset status --since=origin/main --verbose > .changeset-status.txt || { |
74 | | - echo "⚠️ changeset status failed; falling back to listing existing changesets" |
75 | | - ls -1 .changeset/*.md 2>/dev/null || true |
76 | | - : > .changeset-status.txt |
77 | | - } |
78 | | - { |
79 | | - printf 'STATUS<<EOF\n' |
80 | | - cat .changeset-status.txt |
81 | | - printf '\nEOF\n' |
82 | | - } >> "$GITHUB_OUTPUT" |
83 | | -
|
84 | | - # Upsert a single bot comment on the PR with the status preview |
85 | | - - name: 💬 Upsert PR comment with preview |
86 | | - uses: actions/github-script@v7 |
87 | | - env: |
88 | | - BODY: ${{ steps.status.outputs.STATUS }} |
89 | | - with: |
90 | | - script: | |
91 | | - const { owner, repo, number } = context.issue; |
92 | | - const marker = '<!-- changesets-preview-marker -->'; |
93 | | - const header = '### Changesets Preview (since origin/main)\n\n'; |
94 | | - const raw = process.env.BODY || '_No status available._'; |
95 | | - const body = `${header}\n\`\`\`\n${raw}\n\`\`\`\n\n${marker}`; |
96 | | - const { data: comments } = await github.rest.issues.listComments({ owner, repo, issue_number: number, per_page: 100 }); |
97 | | - const existing = comments.find(c => c.user?.type === 'Bot' && c.body?.includes(marker)); |
98 | | - if (existing) { |
99 | | - await github.rest.issues.updateComment({ owner, repo, comment_id: existing.id, body }); |
100 | | - } else { |
101 | | - await github.rest.issues.createComment({ owner, repo, issue_number: number, body }); |
102 | | - } |
103 | | -
|
104 | 67 | # MAIN PATH: Create/Update Release PR & cut tags/releases |
105 | 68 | release_pr: |
106 | 69 | # Only run on main pushes (merge to main done) to drive versioning + tags |
|
0 commit comments