Skip to content

refactor(ci): use reusable workflows from kjldev/.github#101

Merged
kieronlanning merged 1 commit into
mainfrom
refactor/reusable-workflows
May 24, 2026
Merged

refactor(ci): use reusable workflows from kjldev/.github#101
kieronlanning merged 1 commit into
mainfrom
refactor/reusable-workflows

Conversation

@kieronlanning

Copy link
Copy Markdown
Contributor

CI/infra only — extracts release logic to kjldev/.github reusable workflows.

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>
Copilot AI review requested due to automatic review settings May 24, 2026 15:45
@kieronlanning kieronlanning added the skip-changeset PR does not need a changeset entry label May 24, 2026
@kieronlanning kieronlanning enabled auto-merge (squash) May 24, 2026 15:45
@kieronlanning kieronlanning merged commit 9f99595 into main May 24, 2026
7 of 8 checks passed
@kieronlanning kieronlanning deleted the refactor/reusable-workflows branch May 24, 2026 15:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.json patching (repo + base branch) to scripts/setup-release.sh and scripts/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@v4 and actions/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 thread scripts/setup-release.sh
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 thread .github/workflows/ci.yml
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

@kieronlanning kieronlanning restored the refactor/reusable-workflows branch May 24, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changeset PR does not need a changeset entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants