-
Notifications
You must be signed in to change notification settings - Fork 12
chore(ci): add automated dated release workflow #333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
imshashank
merged 21 commits into
Noveum:main
from
Andes-indica:ci/auto-release-workflow
Aug 25, 2026
Merged
Changes from 8 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
5e3c574
chore(ci):add automated dated release workflow
Andes-indica 282c579
updated docs
Andes-indica 941706e
chore(ci): fix release workflow f-string and update docs
Andes-indica 10892c7
ci: add workflow_dispatch to auto-release for manual testing
Andes-indica 2b95956
ci: fix release step GITHUB_TOKEN and use
Andes-indica 97095c0
ci: pin actions/checkout to full commit SHA
Andes-indica 1f4024b
ci: auto-release - migrate notes to Bun TS, fix lint/format; adjust w…
Andes-indica 877f28c
ci(workflows): pin oven-sh/setup-bun v2 to commit SHA in auto-release…
Andes-indica a1a0719
ci:resolved since-declaration causing the test error
Andes-indica 337fb92
ci:resolved tag format error
Andes-indica b8f6fc3
ci:fix release retry boundary and orphan tag handling
Andes-indica fa29954
fix release retry and orphan tag recovery
Andes-indica 7ecc729
Merge branch 'Noveum:main' into ci/auto-release-workflow
Andes-indica 7585b19
ci:fix automated release workflow contract
Andes-indica 2517e9f
Merge branch 'Noveum:main' into ci/auto-release-workflow
Andes-indica 9cb3df4
fix release workflow orphan recovery
Andes-indica a3021d3
fix automated release workflow wiring
Andes-indica 6d9ca76
docs: align automated release guidance
imshashank 1da4666
fix(ci): recover prior dated release tags
imshashank c4c6d60
fix(ci): recover historical dated releases
imshashank 1e0fa1e
fix(ci): avoid overlapping recovery notes
imshashank File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| name: Automated Releases | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '0 0 * * 0' | ||
| workflow_dispatch: | ||
| concurrency: | ||
| group: automated-release | ||
| cancel-in-progress: false | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: read | ||
|
|
||
| jobs: | ||
| tag-and-release: | ||
| name: Create dated tag and release notes | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 | ||
| with: | ||
| fetch-depth: 0 | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| - name: Configure git | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| - name: Setup Bun for scripts | ||
| uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 | ||
| with: | ||
| bun-version: '1.3.14' | ||
|
|
||
| - name: Install JS/TS deps | ||
| run: bun install --frozen-lockfile | ||
|
|
||
| - name: Build release notes (TypeScript) | ||
| id: build_notes | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
greptile-apps[bot] marked this conversation as resolved.
|
||
| since_date: ${{ steps.since.outputs.since_date }} | ||
| run: | | ||
| set -euo pipefail | ||
| bun ./scripts/release-notes.ts | ||
| echo "notes_path=RELEASE_NOTES.md" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Create dated tag | ||
|
Andes-indica marked this conversation as resolved.
Outdated
|
||
| id: create_tag | ||
| run: | | ||
| set -euo pipefail | ||
| BASE_TAG=$(date -u +%Y.%m.%d) | ||
| TAG="$BASE_TAG" | ||
| COUNT=0 | ||
| while git ls-remote --tags origin "refs/tags/$TAG" | grep -q .; do | ||
| COUNT=$((COUNT+1)) | ||
| TAG="$BASE_TAG-$COUNT" | ||
| done | ||
| echo "Tag will be: $TAG" | ||
| git tag -a "$TAG" -m "Automated release $TAG" $GITHUB_SHA | ||
| git push origin "$TAG" | ||
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Create GitHub release | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| set -euo pipefail | ||
| TAG=${{ steps.create_tag.outputs.tag }} | ||
| if [ ! -f RELEASE_NOTES.md ]; then | ||
| echo "No release notes found, creating placeholder." | ||
| echo "Automated release for ${GITHUB_SHA}" > RELEASE_NOTES.md | ||
| fi | ||
| gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --title "$TAG" --notes-file RELEASE_NOTES.md | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| #!/usr/bin/env bun | ||
| import { writeFile } from 'node:fs/promises'; | ||
|
|
||
| type Label = { name: string }; | ||
| type PullRequest = { | ||
| number: number; | ||
| title: string; | ||
| html_url: string; | ||
| body?: string | null; | ||
| labels?: Label[]; | ||
| merged_at?: string | null; | ||
| }; | ||
|
|
||
| const repo = process.env['GITHUB_REPOSITORY']; | ||
| const token = process.env['GITHUB_TOKEN']; | ||
| const sinceEnv = | ||
| process.env['since_date'] || process.env['INPUT_SINCE'] || process.env['GITHUB_SINCE']; | ||
| const _githubSha = process.env['GITHUB_SHA'] || ''; | ||
|
|
||
| if (!repo) { | ||
| console.error('GITHUB_REPOSITORY is not set'); | ||
| process.exitCode = 2; | ||
| throw new Error('GITHUB_REPOSITORY is not set'); | ||
| } | ||
|
|
||
| const since = sinceEnv || new Date(Date.now() - 7 * 24 * 3600 * 1000).toISOString(); | ||
| const [owner, repoName] = repo.split('/'); | ||
|
|
||
| const headers: Record<string, string> = { | ||
| Accept: 'application/vnd.github+json', | ||
| 'User-Agent': 'orbit-release-bot', | ||
| }; | ||
| if (token) headers['Authorization'] = `token ${token}`; | ||
|
|
||
| async function fetchJson(url: string): Promise<unknown> { | ||
| const res = await fetch(url, { headers }); | ||
| const text = await res.text(); | ||
| if (!res.ok) { | ||
| throw new Error(`Request failed ${res.status}: ${text}`); | ||
| } | ||
| return JSON.parse(text); | ||
| } | ||
|
|
||
| async function fetchPageOfPRs(page: number): Promise<PullRequest[]> { | ||
|
Andes-indica marked this conversation as resolved.
Outdated
|
||
| const url = `https://api.github.com/repos/${owner}/${repoName}/pulls?state=closed&per_page=100&sort=updated&direction=desc&page=${page}`; | ||
| const data = await fetchJson(url); | ||
| if (!Array.isArray(data)) return []; | ||
| return data as PullRequest[]; | ||
| } | ||
|
|
||
| async function collectMergedPRs(): Promise<PullRequest[]> { | ||
| const merged: PullRequest[] = []; | ||
| const sinceDate = new Date(since); | ||
| for (let page = 1; ; page++) { | ||
| const pagePRs = await fetchPageOfPRs(page); | ||
| if (pagePRs.length === 0) break; | ||
| for (const p of pagePRs) { | ||
| if (!p.merged_at) continue; | ||
| const mergedAt = new Date(p.merged_at); | ||
| if (mergedAt < sinceDate) return merged; | ||
| merged.push(p); | ||
| } | ||
| if (pagePRs.length < 100) break; | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| } | ||
| return merged; | ||
| } | ||
|
|
||
| function groupByArea(prs: PullRequest[]) { | ||
| const areas: Record<string, PullRequest[]> = {}; | ||
| const breaking: PullRequest[] = []; | ||
| for (const p of prs) { | ||
| const labels = (p.labels || []).map((l) => l.name); | ||
| const body: string = p.body || ''; | ||
| const hasBreakingLabel = labels.some((n) => n.toLowerCase() === 'breaking change'); | ||
| const hasBreakingBody = /BREAKING CHANGE/.test(body); | ||
| if (hasBreakingLabel || hasBreakingBody) { | ||
| breaking.push(p); | ||
| continue; | ||
| } | ||
| const area = labels.find((n) => n.startsWith('area:')) || 'Other'; | ||
| areas[area] = areas[area] || []; | ||
| areas[area].push(p); | ||
| } | ||
| return { areas, breaking }; | ||
| } | ||
|
|
||
| function renderNotes(prs: PullRequest[]): string { | ||
| const { areas, breaking } = groupByArea(prs); | ||
| let body = `Automated release for ${_githubSha}\n\n`; | ||
|
|
||
| if (breaking.length) { | ||
| body += '## Breaking changes\n'; | ||
| for (const pr of breaking) { | ||
| body += `- ${pr.title} (#${pr.number}) ${pr.html_url}\n`; | ||
| if (pr.body) { | ||
| const excerpt = pr.body.split(/\r?\n/).slice(0, 6).join('\n '); | ||
| body += `\n ${excerpt}\n`; | ||
| } | ||
| } | ||
| body += '\n'; | ||
| } | ||
|
|
||
| const areaNames = Object.keys(areas).sort(); | ||
| for (const area of areaNames) { | ||
| const title = area.replace('area:', 'Area: '); | ||
| body += `## ${title}\n`; | ||
| for (const pr of areas[area] ?? []) { | ||
| body += `- ${pr.title} (#${pr.number}) ${pr.html_url}\n`; | ||
| } | ||
| body += '\n'; | ||
| } | ||
|
|
||
| if (!breaking.length && areaNames.length === 0) { | ||
| body += 'No merged pull requests found since the last tag.\n'; | ||
| } | ||
|
|
||
| return body; | ||
| } | ||
|
|
||
| async function main(): Promise<void> { | ||
| const prs = await collectMergedPRs(); | ||
| const notes = renderNotes(prs); | ||
| await writeFile('RELEASE_NOTES.md', notes, 'utf8'); | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| console.log('WROTE RELEASE_NOTES.md'); | ||
| } | ||
|
|
||
| main().catch((err: unknown) => { | ||
| console.error('Failed to generate release notes:', err); | ||
| process.exitCode = 2; | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.