Skip to content

Commit 1cf2162

Browse files
committed
Merge dev into main: v2.20.0 release
2 parents 161c09f + c71c827 commit 1cf2162

308 files changed

Lines changed: 28507 additions & 700 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Clean orphaned workflow runs
2+
3+
# GitHub keeps workflow identities in the Actions sidebar after a temporary
4+
# workflow file is removed. Once every run for that orphan is deleted, GitHub
5+
# can drop the stale workflow entry too.
6+
on:
7+
schedule:
8+
# Daily at 06:00 UTC.
9+
- cron: "0 6 * * *"
10+
push:
11+
branches: [main]
12+
paths:
13+
# The first promotion to main performs the initial backlog cleanup without
14+
# exposing a branch-selectable manual trigger with actions:write.
15+
- ".github/workflows/cleanup-orphaned-workflows.yml"
16+
- "scripts/ci/cleanup-orphaned-workflows.mjs"
17+
18+
permissions:
19+
actions: write # Required to delete orphaned workflow runs through the Actions API.
20+
contents: read
21+
22+
concurrency:
23+
group: cleanup-orphaned-workflows
24+
cancel-in-progress: false
25+
26+
jobs:
27+
cleanup:
28+
name: Delete orphaned workflow runs
29+
runs-on: ubuntu-latest
30+
timeout-minutes: 10
31+
steps:
32+
- name: Checkout trusted default-branch code
33+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
34+
with:
35+
persist-credentials: false
36+
37+
- name: Setup Bun
38+
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
39+
with:
40+
bun-version: 1.3.14
41+
42+
- name: Remove stale workflow histories
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
run: bun scripts/ci/cleanup-orphaned-workflows.mjs

.github/workflows/release.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,10 @@ jobs:
374374
notes_file="$(mktemp)"
375375
carried_file="$(mktemp)"
376376
delta_file="$(mktemp)"
377+
commit_fallback_file="$(mktemp)"
377378
: > "$carried_file"
378379
: > "$delta_file"
380+
: > "$commit_fallback_file"
379381
380382
# Stable releases after matching previews: aggregate every matching preview
381383
# changelog (oldest→newest; each preview body is incremental), then only
@@ -449,6 +451,31 @@ jobs:
449451
pr_notes="$(gh api "${generate_notes_api[@]}" --jq '.body')"
450452
# Drop generate-notes' trailing compare link; we re-append it after the commit list.
451453
printf '%s\n' "$pr_notes" | sed '/^\*\*Full Changelog\*\*:/d' > "$delta_file"
454+
455+
# generate-notes counts MERGED PULL REQUESTS in the tag range. Work that lands
456+
# as direct commits on the integration branch (or via PRs based on `dev` rather
457+
# than this release branch) leaves that range with nothing to aggregate, and the
458+
# body collapses to the npm line plus a compare link — v2.17.0..v2.18.2 shipped
459+
# exactly that, 0 of 36 commits PR-associated. Fall back to the commit log so a
460+
# release can never publish an empty changelog.
461+
# The renderer only keeps entries carrying a PR number, so the fallback
462+
# travels in its own channel (--commit-fallback). The decision depends on
463+
# THIS range's PR delta only: carried preview notes cover the pre-preview
464+
# span, so gating on them too would silently drop every post-preview
465+
# direct commit. The renderer decides whether to emit the channel.
466+
if ! bun scripts/release-notes.ts has-meaningful "$delta_file"; then
467+
commit_log_file="$(mktemp)"
468+
# NUL-delimited: Git forbids NUL in commit content, so neither a crafted
469+
# subject nor an author name can forge a field boundary.
470+
git log -z --format='%H%x00%s%x00%an' "${notes_range_start}..${GITHUB_SHA}" > "$commit_log_file"
471+
bun scripts/release-notes.ts commit-fallback "$commit_log_file" > "$commit_fallback_file"
472+
if bun scripts/release-notes.ts has-meaningful "$commit_fallback_file"; then
473+
echo "::notice::generate-notes returned no PR categories for ${notes_range_start}..${release_tag}; using the commit-based changelog fallback"
474+
else
475+
: > "$commit_fallback_file"
476+
echo "::notice::No PR categories and no eligible commits in ${notes_range_start}..${release_tag}; release notes stay minimal"
477+
fi
478+
fi
452479
else
453480
# First release on this channel: never call generate-notes without previous_tag_name.
454481
# GitHub would baseline the newest repo tag, which may belong to the other channel.
@@ -476,6 +503,7 @@ jobs:
476503
--npm-metadata "$npm_metadata"
477504
--carried "$carried_file"
478505
--delta "$delta_file"
506+
--commit-fallback "$commit_fallback_file"
479507
--out "$notes_file"
480508
--compare-to "$release_tag"
481509
--repository "$GITHUB_REPOSITORY"
47.9 KB
Loading

0 commit comments

Comments
 (0)