Skip to content

Commit d88f2ea

Browse files
authored
Merge branch 'develop' into feat/phase-1
2 parents 61f3176 + 221d758 commit d88f2ea

6 files changed

Lines changed: 64 additions & 24 deletions

File tree

.github/actionlint.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
self-hosted-runner:
2+
labels:
3+
- blacksmith-32vcpu-ubuntu-2404
4+
- blacksmith-8vcpu-ubuntu-2404
5+
- blacksmith-6vcpu-macos-latest
6+
- blacksmith-8vcpu-windows-2025

.github/workflows/apply-release-notes.yml

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ name: Apply release notes
44
# release-notes PR (head ref `release-notes/v<VERSION>`), this workflow pushes
55
# the proposed notes to the GitHub Release body for the corresponding tag,
66
# comments the release URL on the PR, and closes the PR without merging. The
7-
# release-notes file never lands on `main`.
7+
# release-notes PR targets `develop` (not `main`) so an accidental merge can
8+
# never rewrite `main`'s history; the file is not meant to land on any branch.
89
#
910
# Mirrors the fast-forward job in release.yml, which already gates on a
1011
# `pull_request_review` + `approved` event.
@@ -17,29 +18,31 @@ permissions:
1718
contents: read
1819

1920
jobs:
20-
apply:
21+
authorize:
2122
# `state == 'open'` makes re-approvals on an already-closed PR a no-op
2223
# (a reviewer can re-approve from the GitHub UI even after close).
2324
if: |
2425
github.event.review.state == 'approved' &&
2526
startsWith(github.event.pull_request.head.ref, 'release-notes/') &&
26-
github.event.pull_request.base.ref == 'main' &&
27+
github.event.pull_request.base.ref == 'develop' &&
2728
github.event.pull_request.state == 'open'
2829
runs-on: ubuntu-latest
2930
permissions:
30-
contents: write
3131
pull-requests: write
32+
outputs:
33+
authorized: ${{ steps.check.outputs.authorized }}
3234
steps:
3335
# App token: needs `orgs/.../teams/.../memberships` read (the org-installed
3436
# App has it), repo write to edit the release, and PR write to comment
3537
# and close. Matches release.yml's fast-forward step.
3638
- id: app-token
37-
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
39+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
3840
with:
39-
app-id: ${{ secrets.APP_ID }}
41+
client-id: ${{ vars.GH_APP_CLIENT_ID }}
4042
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
4143

4244
- name: Authorize approver against supabase/cli team
45+
id: check
4346
env:
4447
GH_TOKEN: ${{ steps.app-token.outputs.token }}
4548
APPROVER: ${{ github.event.review.user.login }}
@@ -57,25 +60,37 @@ jobs:
5760
echo "Approver @${APPROVER} is not an active supabase/cli team member (state='${status:-none}'); ignoring approval." >&2
5861
gh pr comment "$PR_NUMBER" --repo "${{ github.repository }}" --body \
5962
"@${APPROVER} is not an active \`supabase/cli\` team member, so this approval was ignored. Ask a team member to approve to publish the notes."
63+
echo "authorized=false" >> "$GITHUB_OUTPUT"
6064
exit 0
6165
fi
62-
echo "AUTHORIZED=true" >> "$GITHUB_ENV"
66+
echo "authorized=true" >> "$GITHUB_OUTPUT"
67+
68+
apply:
69+
needs: authorize
70+
if: needs.authorize.outputs.authorized == 'true'
71+
runs-on: ubuntu-latest
72+
permissions:
73+
contents: write
74+
pull-requests: write
75+
steps:
76+
- id: app-token
77+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
78+
with:
79+
client-id: ${{ vars.GH_APP_CLIENT_ID }}
80+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
6381

6482
# Checkout the PR head so any reviewer edits made in the GitHub UI before
6583
# approval are captured. apply-release-notes.ts reads from the working
6684
# tree.
67-
- if: env.AUTHORIZED == 'true'
68-
uses: useblacksmith/checkout@41cdeedae8edb2e684ba22896a5fd2a3cb85db6b # v1
85+
- uses: useblacksmith/checkout@41cdeedae8edb2e684ba22896a5fd2a3cb85db6b # v1
6986
with:
7087
ref: ${{ github.event.pull_request.head.sha }}
7188
fetch-depth: 1
7289
persist-credentials: false
7390

74-
- if: env.AUTHORIZED == 'true'
75-
uses: ./.github/actions/setup
91+
- uses: ./.github/actions/setup
7692

7793
- name: Apply notes, comment, and close
78-
if: env.AUTHORIZED == 'true'
7994
env:
8095
GH_TOKEN: ${{ steps.app-token.outputs.token }}
8196
HEAD_REF: ${{ github.event.pull_request.head.ref }}

.github/workflows/propose-release-notes.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ on:
2222
required: false
2323
type: boolean
2424
default: false
25+
secrets:
26+
ANTHROPIC_API_KEY:
27+
required: true
28+
GH_APP_PRIVATE_KEY:
29+
required: true
2530
workflow_dispatch:
2631
inputs:
2732
tag:
@@ -38,7 +43,7 @@ jobs:
3843
# allow any tag so reviewers can opt in for beta/alpha from the Actions tab.
3944
if: ${{ github.event_name == 'workflow_dispatch' || (!contains(inputs.tag, '-beta.') && !contains(inputs.tag, '-alpha.')) }}
4045
runs-on: ubuntu-latest
41-
continue-on-error: ${{ inputs.non_blocking }}
46+
continue-on-error: ${{ inputs.non_blocking || false }}
4247
permissions:
4348
contents: write
4449
pull-requests: write
@@ -49,9 +54,9 @@ jobs:
4954
# App token gets us push to a protected default branch *and* PR creation
5055
# under the App identity, matching the rest of release.yml.
5156
- id: app-token
52-
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
57+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
5358
with:
54-
app-id: ${{ secrets.APP_ID }}
59+
client-id: ${{ vars.GH_APP_CLIENT_ID }}
5560
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
5661

5762
- uses: useblacksmith/checkout@41cdeedae8edb2e684ba22896a5fd2a3cb85db6b # v1

.github/workflows/release-shared.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ on:
5151
required: false
5252
GH_APP_PRIVATE_KEY:
5353
required: false
54+
ANTHROPIC_API_KEY:
55+
required: false
5456
jobs:
5557
build:
5658
name: Build CLI artifacts
@@ -335,7 +337,9 @@ jobs:
335337
with:
336338
tag: v${{ inputs.version }}
337339
non_blocking: true
338-
secrets: inherit
340+
secrets:
341+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
342+
GH_APP_PRIVATE_KEY: ${{ secrets.GH_APP_PRIVATE_KEY }}
339343

340344
publish-homebrew:
341345
needs: publish

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292
if: github.event_name == 'push'
9393
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
9494
with:
95-
app-id: ${{ secrets.APP_ID }}
95+
client-id: ${{ vars.GH_APP_CLIENT_ID }}
9696
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
9797
permission-contents: write
9898
# `persist-credentials: false` is required: otherwise checkout caches the
@@ -208,6 +208,7 @@ jobs:
208208
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
209209
POSTHOG_ENDPOINT: ${{ secrets.POSTHOG_ENDPOINT }}
210210
GH_APP_PRIVATE_KEY: ${{ secrets.GH_APP_PRIVATE_KEY }}
211+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
211212

212213
# Posts to the release Slack channel once the pipeline succeeds. Listing
213214
# `release` in `needs` without a status function in `if:` keeps the implicit

apps/cli/scripts/propose-release-notes.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
// `release-notes/v<VERSION>` and opens a PR. Approving the PR (as a
2020
// supabase/cli team member) triggers apply-release-notes.yml, which
2121
// pushes the file's contents to the GH release body and closes the PR
22-
// without merging — the file never lands on `main`.
22+
// without merging. The PR targets `develop` (not `main`) so an
23+
// accidental merge can never rewrite `main`'s history; in practice the
24+
// file never lands on any branch.
2325
//
2426
// Usage:
2527
// bun apps/cli/scripts/propose-release-notes.ts --tag v2.101.0 --dry-run
@@ -145,10 +147,17 @@ await writeFile(notesPath, normalized);
145147
console.error(`==> Wrote ${path.relative(repoRoot, notesPath)}`);
146148

147149
const branch = `release-notes/v${version}`;
148-
const currentBranch = (await $`git rev-parse --abbrev-ref HEAD`.cwd(repoRoot).text()).trim();
149-
if (currentBranch !== branch) {
150-
await $`git checkout -B ${branch}`.cwd(repoRoot);
151-
}
150+
// Always cut the notes branch from origin/develop — the PR base. The workflow
151+
// can be dispatched from an arbitrary feature branch that has diverged from
152+
// the base by many commits; branching off the checked-out ref would drag
153+
// every one of those commits into the PR (so the PR shows N changed files
154+
// instead of just the proposed notes). The notes file is untracked at this
155+
// point, so resetting HEAD to origin/develop leaves it untouched in the
156+
// working tree. We target `develop` rather than `main` so that an accidental
157+
// merge of this approval-only PR lands on the integration branch instead of
158+
// rewriting `main`'s history.
159+
await $`git fetch --no-tags origin develop`.cwd(repoRoot).nothrow();
160+
await $`git checkout -B ${branch} origin/develop`.cwd(repoRoot);
152161
await $`git add ${notesPath}`.cwd(repoRoot);
153162
const commitMessage = `docs(release): propose user-facing notes for ${tag}`;
154163
await $`git commit -m ${commitMessage}`.cwd(repoRoot);
@@ -194,7 +203,7 @@ Approve this PR as a \`supabase/cli\` team member. The \`.github/workflows/apply
194203
2. Comment the release URL on this PR.
195204
3. Close this PR and delete the \`${branch}\` branch.
196205
197-
**This PR is not merged** — the \`do not merge\` label is a reminder. Nothing lands on \`main\`.
206+
**This PR is not merged** — the \`do not merge\` label is a reminder. It targets \`develop\` so that even an accidental merge never rewrites \`main\`. Nothing is meant to land on any branch.
198207
199208
Approvals from anyone outside the \`supabase/cli\` team are ignored; the workflow will post a comment explaining that and leave the release untouched.
200209
@@ -207,7 +216,7 @@ Close the PR without approving. The auto-generated semantic-release body for \`$
207216
After this PR is closed, rerun the **Propose release notes** workflow from the Actions tab against \`${tag}\` to get a fresh proposal.
208217
`;
209218

210-
await $`gh pr create --title ${`docs(release): notes for ${tag}`} --body ${prBody} --base main --head ${branch} --label ${labelName}`.cwd(
219+
await $`gh pr create --title ${`docs(release): notes for ${tag}`} --body ${prBody} --base develop --head ${branch} --label ${labelName}`.cwd(
211220
repoRoot,
212221
);
213222
console.error(`==> PR opened for ${branch}`);

0 commit comments

Comments
 (0)