-
Notifications
You must be signed in to change notification settings - Fork 29
Publish the fizzy skill to basecamp/skills on release #214
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
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5ed19d8
Publish the fizzy skill to basecamp/skills on release
jeremy f2fc0f8
Name the pre-fix sibling test after what it tests
jeremy 63fd049
Converge on the seed's sync-skills.sh and its test
jeremy ed326de
Always clone the skills target fresh; retire SKILLS_TARGET and its gu…
jeremy 981ae20
Say what the private gitconfig replaces, and what it does not
jeremy 3af229e
Skip the release-time skills sync for anything but the latest stable …
jeremy a917e94
Run the sync as the source its CLI_NAME default names
jeremy 540866d
Send the token as a github.com-scoped Authorization header, not a URL…
jeremy 14d039f
Say that make check runs the skills sync test too
jeremy 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
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
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,119 @@ | ||
| # Manual skills sync, for when the release-time sync could not run. | ||
| # | ||
| # The sync-skills job in release.yml is `needs: [release]`, so anything that | ||
| # fails the release job after publication skips the sync entirely and leaves | ||
| # basecamp/skills stale against a shipped release. A skipped or failed sync | ||
| # needs a way back without cutting a new tag. This is it. | ||
| # | ||
| # scripts/sync-skills.sh mirrors the skills/ tree at the given ref into | ||
| # basecamp/skills — only this CLI's skills, tracked in its own manifest there | ||
| # (.managed-skills.fizzy-cli); other CLIs' skills are never touched — and no-ops | ||
| # when the content already matches, so re-running it for an already-synced | ||
| # release is safe. | ||
| name: Sync skills | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: 'Release tag to sync from, with the v prefix (e.g. v4.1.0)' | ||
| required: true | ||
| type: string | ||
| dry_run: | ||
| description: 'Preview the sync without pushing' | ||
| required: false | ||
| default: false | ||
| type: boolean | ||
|
|
||
| permissions: {} | ||
|
|
||
| # Shared with release.yml's sync-skills job so a manual run cannot interleave | ||
| # with an automatic one. | ||
| concurrency: | ||
| group: sync-skills | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| sync: | ||
| name: Sync skills | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| environment: release | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Validate tag input | ||
| env: | ||
| TAG: ${{ inputs.tag }} | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| # No prerelease suffix: the automatic sync in release.yml excludes | ||
| # prereleases deliberately, and this path must not smuggle prerelease | ||
| # content into the distribution repo's main branch. | ||
| if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
| echo "::error::Invalid tag '${TAG}' — expected a stable v-prefixed semver tag (e.g. v4.1.0)" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # sync-skills.sh mirrors this CLI's skills wholesale, so syncing an | ||
| # older tag would roll them back in basecamp/skills. The only reason to run this by | ||
| # hand is that the newest release failed to sync — so require exactly | ||
| # that release. | ||
| latest=$(gh release view --repo "${GITHUB_REPOSITORY}" --json tagName --jq .tagName) | ||
| if [ "$TAG" != "$latest" ]; then | ||
| echo "::error::Refusing to sync ${TAG}: the latest stable release is ${latest}. Syncing an older tag would roll basecamp/skills back." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Two checkouts: sync logic from the dispatching ref, skills content from | ||
| # the release tag. A defect in scripts/sync-skills.sh is one of the ways | ||
| # the automatic sync fails, and running the tagged copy here would just | ||
| # re-run the defective script — recovery must be able to run a fix merged | ||
| # to main without cutting a new tag. | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
|
jeremy marked this conversation as resolved.
|
||
|
|
||
| # The content still mirrors the skills tree as it was released, even if | ||
| # main has moved on since: SKILLS_SOURCE points the script at this | ||
| # checkout. Fully qualified: actions/checkout resolves a bare name as a | ||
| # branch before a tag, so a branch sharing the tag's name would win and | ||
| # mirror unreleased content. | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| ref: refs/tags/${{ inputs.tag }} | ||
| path: release | ||
| persist-credentials: false | ||
|
|
||
| # Needed for dry runs too: the honest preview clones the target, so it | ||
| # cannot run tokenless. Dry runs get a read-only token, which is also what | ||
| # stops DRY_RUN=remote from pushing even if the script were wrong. | ||
| - name: Generate token for skills repo | ||
| id: skills-token | ||
| uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 | ||
| with: | ||
| client-id: ${{ vars.RELEASE_CLIENT_ID }} | ||
| private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} | ||
| owner: basecamp | ||
| repositories: skills | ||
| permission-contents: ${{ inputs.dry_run && 'read' || 'write' }} | ||
|
|
||
| # github.sha is the dispatching ref's SHA (main), not the tag's, so | ||
| # resolve the tagged commit from its own checkout — otherwise the sync | ||
| # records the wrong provenance for the release it claims to mirror. | ||
| - name: Resolve the tagged commit | ||
| id: source | ||
| env: | ||
| TAG: ${{ inputs.tag }} | ||
| run: echo "sha=$(git -C release rev-parse --verify "refs/tags/${TAG}^{commit}")" >> "$GITHUB_OUTPUT" | ||
|
|
||
| # DRY_RUN=remote clones the actual target and stops before the push, so | ||
| # the preview shows the real diff including deletions. | ||
| - name: Sync skills to distribution repo | ||
| env: | ||
| SKILLS_TOKEN: ${{ steps.skills-token.outputs.token }} | ||
| RELEASE_TAG: ${{ inputs.tag }} | ||
| SOURCE_SHA: ${{ steps.source.outputs.sha }} | ||
| SKILLS_SOURCE: release/skills | ||
| DRY_RUN: ${{ inputs.dry_run && 'remote' || '' }} | ||
| run: scripts/sync-skills.sh | ||
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
Oops, something went wrong.
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.