Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions .github/workflows/reusable-update-from-skeleton.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@ on:
workflow_call:
inputs:
recopy:
description: "Perform a full recopy instead of an incremental update (overwrites
description:
"Perform a full recopy instead of an incremental update (overwrites
all templated files), and re-runs any tasks defined in copier.yml. The
resulting PR will require manual review and merging."
type: boolean
default: false
skeleton_update_app_id:
description: "The GitHub App ID of the app to use for authentication when
description:
"The GitHub App ID of the app to use for authentication when
pushing updates. The app must be installed on the repository and have
permissions to read and write code, as well as create pull requests."
required: false
type: string
default: ${{ vars.LAUNCH_SKELETON_UPDATE_APP_ID }}
secrets:
LAUNCH_SKELETON_UPDATE_KEY:
description: "The private key for the GitHub App used for authentication when
description:
"The private key for the GitHub App used for authentication when
pushing updates. The app must be installed on the repository and have
permissions to read and write code, as well as create pull requests."
required: true
Expand All @@ -44,6 +47,26 @@ jobs:
with:
token: ${{ steps.get-app-token.outputs.token }}

- name: Setup asdf
uses: asdf-vm/actions/setup@b7bcd026f18772e44fe1026d729e1611cc435d47

- uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306
name: Restore cached asdf tools
id: cache
with:
path: ~/.asdf
key: ${{ runner.os }}-tool-versions-${{ hashFiles('.tool-versions') }}

- name: Install asdf tools
run: asdf install

- uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306
name: Cache asdf tools
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ~/.asdf
key: ${{ runner.os }}-tool-versions-${{ hashFiles('.tool-versions') }}

- id: setup-python
name: Set up Python 3.14
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57
Expand Down Expand Up @@ -130,6 +153,8 @@ jobs:
fi
else
rm -f "$PRE_COMMIT_LOG"
echo "No merge conflicts detected, running all pre-commit checks"
pre-commit run --all-files || pre-commit run --all-files
echo "Pre-commit checks passed"
echo "pre_commit_passed=true" >> "$GITHUB_OUTPUT"
fi
Expand Down
27 changes: 16 additions & 11 deletions docs/reusable-update-from-skeleton.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,27 @@ Keeps a repository in sync with its upstream [Copier](https://copier.readthedocs

```mermaid
flowchart TD
A[Workflow Triggered] --> B[Run copier update/recopy]
B --> C{Changes detected?}
C -- No --> D[Done]
C -- Yes --> E{Pre-commit passes?}
E -- Yes --> F[Create PR with auto-merge]
E -- No --> G[Create PR requiring manual review]
A[Workflow Triggered] --> B[Install asdf tools]
B --> C[Run copier update/recopy]
C --> D{Changes detected?}
D -- No --> E[Done]
D -- Yes --> F{Merge conflicts?}
F -- Yes --> G[Create PR requiring manual review]
F -- No --> H[Run all pre-commit checks]
H --> I[Create PR with auto-merge]
```

## Behavior

1. **Copier update** — Runs `copier update --defaults --trust` to pull the latest changes from the skeleton template. If the repository's `prerelease` custom property is `true`, the `--prerelease` flag is added to pick up prerelease skeleton versions.
2. **Recopy mode** — When `recopy` is set to `true`, runs `copier recopy --defaults --trust --overwrite` instead, which overwrites all templated files. Recopy PRs always require manual review.
3. **Pre-commit validation** — If a `.pre-commit-config.yaml` exists, runs `check-merge-conflict` against all files to detect merge conflict markers.
4. **Pull request creation**:
1. **Tool installation** — Installs tools defined in the repository's `.tool-versions` file via asdf (with caching), then installs Copier and pre-commit via uv.
2. **Copier update** — Runs `copier update --defaults --trust` to pull the latest changes from the skeleton template. If the repository's `prerelease` custom property is `true`, the `--prerelease` flag is added to pick up prerelease skeleton versions.
3. **Recopy mode** — When `recopy` is set to `true`, runs `copier recopy --defaults --trust --overwrite` instead, which overwrites all templated files. Recopy PRs always require manual review.
4. **Pre-commit validation** — If a `.pre-commit-config.yaml` exists, validation runs in two phases:
- First, `check-merge-conflict` runs against all files. If merge conflict markers are found, the PR is flagged for manual review.
- If no conflicts are found, all pre-commit hooks run against all files. Any automatic fixes (formatting, trailing whitespace, etc.) are included in the resulting commit.
5. **Pull request creation**:
- If pre-commit passes and recopy is not enabled, a PR titled `chore: update from skeleton` is created with auto-merge enabled.
- If pre-commit fails or recopy is enabled, a PR titled `fix: update from skeleton` is created and flagged for manual review. Any files with merge conflict markers are listed in the PR body.
- If pre-commit fails (merge conflicts) or recopy is enabled, a PR titled `fix: update from skeleton` is created and flagged for manual review. Any files with merge conflict markers are listed in the PR body.

## Usage

Expand Down
Loading