refactor(ci): use reusable workflows from kjldev/.github#101
Merged
Conversation
Extract generic release mechanics to the org-wide kjldev/.github repo. Caller workflows now delegate to the reusable versions via workflow_call, making the release process adoptable across all repos with a single reference. - release-pr.yml: thin caller of kjldev/.github/.github/workflows/release-pr.yml - ci.yml: changeset-check delegates to kjldev/.github/.github/workflows/changeset-check.yml - workflows: fix action versions (checkout@v4, setup-dotnet@v4) - scripts: add --base-branch param + Step 0 auto-patches .changeset/config.json Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the repository’s CI/release automation to consume reusable workflows from kjldev/.github, and updates the local release-setup scripts to also configure .changeset/config.json.
Changes:
- Add
.changeset/config.jsonpatching (repo + base branch) toscripts/setup-release.shandscripts/setup-release.ps1. - Replace the inline Release PR workflow and changeset-check job with reusable workflows from
kjldev/.github. - Update GitHub Actions used in CI/CD workflows to
actions/checkout@v4andactions/setup-dotnet@v4.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/setup-release.sh | Adds --base-branch and a Step 0 to patch .changeset/config.json. |
| scripts/setup-release.ps1 | Adds BaseBranch and patches .changeset/config.json before rulesets/labels/secrets steps. |
| .github/workflows/release-pr.yml | Replaces inline release PR logic with a reusable workflow call. |
| .github/workflows/ci.yml | Uses a reusable changeset-check workflow and updates action versions. |
| .github/workflows/cd.yml | Updates action versions used in CD. |
Comment on lines
+178
to
+181
| current_repo="$(python3 -c "import json,sys; d=json.load(open('${CHANGESET_CONFIG}')); cfg=d.get('changelog'); print(cfg[1]['repo'] if isinstance(cfg,list) else '')" 2>/dev/null || true)" | ||
|
|
||
| if [[ "${current_repo}" == "${FULL_REPO}" ]]; then | ||
| success ".changeset/config.json already points to ${FULL_REPO} — skipping." |
Comment on lines
1
to
+17
| name: Release PR | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| release-pr: | ||
| name: Create or update Release PR | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Generate GitHub App token | ||
| id: app-token | ||
| if: ${{ secrets.APP_ID != '' }} | ||
| uses: actions/create-github-app-token@v1 | ||
| with: | ||
| app-id: ${{ secrets.APP_ID }} | ||
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | ||
|
|
||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| token: ${{ steps.app-token.outputs.token || secrets.CHANGESET_TOKEN }} | ||
|
|
||
| - name: Set up Bun | ||
| uses: oven-sh/setup-bun@v2 | ||
|
|
||
| - name: Install dependencies | ||
| run: bun install | ||
|
|
||
| - name: Create or update Release PR | ||
| uses: changesets/action@v1 | ||
| with: | ||
| version: bun run version-packages | ||
| createGithubReleases: false | ||
| env: | ||
| GITHUB_TOKEN: ${{ steps.app-token.outputs.token || secrets.CHANGESET_TOKEN }} | ||
| uses: kjldev/.github/.github/workflows/release-pr.yml@main | ||
| with: | ||
| install-command: bun install | ||
| version-command: bun run version-packages | ||
| secrets: | ||
| APP_ID: ${{ secrets.APP_ID }} | ||
| APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} | ||
| CHANGESET_TOKEN: ${{ secrets.CHANGESET_TOKEN }} |
Comment on lines
9
to
+11
| release-pr: | ||
| name: Create or update Release PR | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Generate GitHub App token | ||
| id: app-token | ||
| if: ${{ secrets.APP_ID != '' }} | ||
| uses: actions/create-github-app-token@v1 | ||
| with: | ||
| app-id: ${{ secrets.APP_ID }} | ||
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | ||
|
|
||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| token: ${{ steps.app-token.outputs.token || secrets.CHANGESET_TOKEN }} | ||
|
|
||
| - name: Set up Bun | ||
| uses: oven-sh/setup-bun@v2 | ||
|
|
||
| - name: Install dependencies | ||
| run: bun install | ||
|
|
||
| - name: Create or update Release PR | ||
| uses: changesets/action@v1 | ||
| with: | ||
| version: bun run version-packages | ||
| createGithubReleases: false | ||
| env: | ||
| GITHUB_TOKEN: ${{ steps.app-token.outputs.token || secrets.CHANGESET_TOKEN }} | ||
| uses: kjldev/.github/.github/workflows/release-pr.yml@main | ||
| with: |
Comment on lines
83
to
86
| changeset-check: | ||
| name: Changeset Check | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Check for changeset | ||
| env: | ||
| HEAD_REF: ${{ github.head_ref }} | ||
| PR_LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }} | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| # Version Packages PRs are created by the release bot — no changeset needed | ||
| if [[ "${HEAD_REF}" == changeset-release/* ]]; then | ||
| echo "Version Packages PR — changeset check skipped." | ||
| exit 0 | ||
| fi | ||
|
|
||
| # PRs labelled skip-changeset are explicitly opted out (docs-only, CI-only, etc.) | ||
| if echo "${PR_LABELS}" | grep -q '"skip-changeset"'; then | ||
| echo "skip-changeset label present — changeset check skipped." | ||
| exit 0 | ||
| fi | ||
|
|
||
| git fetch origin main --depth=1 | ||
|
|
||
| changed_files="$(git diff --name-only origin/main...HEAD)" | ||
| changeset_files="$(echo "${changed_files}" | grep -E '^\.changeset/[^/]+\.md$' | grep -v 'README\.md' || true)" | ||
|
|
||
| if [[ -z "${changeset_files}" ]]; then | ||
| echo "::error::No changeset file found." | ||
| echo "::error::Run 'just changeset' to create one, or add the 'skip-changeset' label if this PR needs no release note." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "✅ Changeset found:" | ||
| echo "${changeset_files}" | ||
| uses: kjldev/.github/.github/workflows/changeset-check.yml@main | ||
|
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
CI/infra only — extracts release logic to kjldev/.github reusable workflows.