Skip to content

Commit db381a9

Browse files
committed
Merge branch '42-integrate-changeset' into chore-changesets-dryrun
2 parents 9955d57 + 9b964d7 commit db381a9

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

.github/workflows/changesets-release-pr.yml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ jobs:
2323
if: github.event_name == 'pull_request'
2424
name: 🔎 Changesets Preview (PR)
2525
runs-on: ubuntu-24.04
26-
2726
steps:
2827
- name: ⏬ Checkout PR head (not merge ref)
2928
uses: actions/checkout@v4
@@ -34,13 +33,30 @@ jobs:
3433
- name: 🔄 Init Node & NPM cache
3534
uses: ./.github/actions/npm-cache
3635

37-
- name: 📋 Show changeset status
36+
- name: 🔁 Fetch base branch (main)
37+
run: |
38+
git remote set-url origin "https://github.com/${{ github.repository }}.git"
39+
git fetch --no-tags --prune --depth=0 origin +refs/heads/main:refs/remotes/origin/main
40+
git branch -a
41+
git rev-parse HEAD
42+
git rev-parse remotes/origin/main
43+
44+
- name: 📋 Show changeset status (since origin/main)
3845
id: status
46+
shell: bash
3947
run: |
40-
npx changeset status --verbose > .changeset-status.txt || true
41-
echo "STATUS<<EOF" >> $GITHUB_OUTPUT
42-
cat .changeset-status.txt >> $GITHUB_OUTPUT
43-
echo "EOF" >> $GITHUB_OUTPUT
48+
set -euo pipefail
49+
# explizit gegen die Remote-Base vergleichen:
50+
npx changeset status --since=origin/main --verbose > .changeset-status.txt || {
51+
echo "⚠️ changeset status failed; falling back to listing existing changesets"
52+
ls -1 .changeset/*.md 2>/dev/null || true
53+
exit 0
54+
}
55+
{
56+
echo "STATUS<<'EOF'"
57+
cat .changeset-status.txt
58+
echo "EOF"
59+
} >> "$GITHUB_OUTPUT"
4460
4561
- name: 💬 Upsert PR comment with preview
4662
uses: actions/github-script@v7
@@ -50,9 +66,9 @@ jobs:
5066
script: |
5167
const { owner, repo, number } = context.issue;
5268
const marker = '<!-- changesets-preview-marker -->';
53-
const header = '### Changesets Preview\n\n';
54-
const bodyRaw = process.env.BODY || '';
55-
const body = `${header}\n\`\`\`\n${bodyRaw}\n\`\`\`\n\n${marker}`;
69+
const header = '### Changesets Preview (since origin/main)\n\n';
70+
const raw = process.env.BODY || '_No status available._';
71+
const body = `${header}\n\`\`\`\n${raw}\n\`\`\`\n\n${marker}`;
5672
const { data: comments } = await github.rest.issues.listComments({ owner, repo, issue_number: number, per_page: 100 });
5773
const existing = comments.find(c => c.user?.type === 'Bot' && c.body?.includes(marker));
5874
if (existing) {
@@ -88,10 +104,6 @@ jobs:
88104
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89105
HUSKY: "0" # disable Husky hooks in CI
90106
CI: "true"
91-
GIT_AUTHOR_NAME: "github-actions[bot]"
92-
GIT_AUTHOR_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
93-
GIT_COMMITTER_NAME: "github-actions[bot]"
94-
GIT_COMMITTER_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
95107

96108
- name: 🖨️ Summary
97109
if: always()

0 commit comments

Comments
 (0)