You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4e4607d
Browse filesBrowse the repository at this point in the historyBrowse files
Publish the fizzy skill to basecamp/skills on release (#214)
* Publish the fizzy skill to basecamp/skills on release
basecamp/skills is becoming the skills repo for every 37signals product,
and Fizzy was the one CLI not publishing there. Stable releases now mirror
skills/ into it with the same sync-skills.sh basecamp-cli and hey-cli run,
which owns only this CLI's skills via a per-source manifest
(.managed-skills.fizzy-cli) and never touches a sibling's
(basecamp/skills#5). The job is continue-on-error and files a
skills-sync issue on failure; sync-skills.yml is the manual recovery.
The sibling repos' BATS test is ported to plain bash, since this repo's
toolchain has no BATS, and runs as make test-scripts (part of make check)
and in CI.
* Name the pre-fix sibling test after what it tests
* Converge on the seed's sync-skills.sh and its test
The seed (basecamp/cli#78) went further than the hey-cli copy taken
first: a rejected push re-applies the sync from the remote's new tip
(matching git's "fetch first" as well as "non-fast-forward"), a name
another source's manifest holds is refused before anything is copied,
SYNC_SOURCE and DRY_RUN are validated, a dirty checkout is refused, and
the token reaches git through a private config rather than the remote
URL. basecamp-cli and hey-cli are converging on the same file, so every
publisher runs one script; only the CLI_NAME default differs here.
The seed's test-sync-skills.sh replaces the bash port of the BATS file:
it covers the same ownership cases plus the racing publisher, the
publish-side refusal, DRY_RUN=remote and the dirty-tree guard.
* Always clone the skills target fresh; retire SKILLS_TARGET and its guards
Mirrors basecamp/cli@966966e (the seed is the source of truth; only the
CLI_NAME default differs here), and picks up the two seed commits this copy
was behind: the remote-URL assert that read every configured URL, and two
comment rewordings — both now moot, since the assert is gone.
SKILLS_TARGET let the script adopt an existing checkout of basecamp/skills.
Every release path clones its own target, and each review round found
another corner of "any checkout" to guard. The script now always clones
into a temp directory from SKILLS_REPO_URL (default
https://github.com/basecamp/skills.git, the token carried through the same
insteadOf rewrite as before), applies, pushes and cleans up, so the only
commit it can push is the one it made. The remote-URL, branch and
clean-tree asserts are gone with the knob; the retry from the fetched tip,
the per-source manifests, the collision guard, the tombstone and DRY_RUN
validation are unchanged.
The test points SKILLS_REPO_URL at a local bare repository and reads every
result back from a clone of its own; the race is staged with a post-commit
hook that pushes the sibling's commit between the script's clone and push.
* Say what the private gitconfig replaces, and what it does not
Mirrors the seed (basecamp/cli#78 at 1df3bfe5). GIT_CONFIG_GLOBAL stands in for
the user's global file only. The system config and any GIT_CONFIG_COUNT settings
in the environment still reach every git call the script makes — the race test
injects its hooks path through exactly that — so the comment no longer claims the
ambient environment is kept out.
* Skip the release-time skills sync for anything but the latest stable release
The sync-skills job's concurrency group serialises the syncs but does not order
them by version. An older stable release's job can reach the sync after a newer
one has published — its run stalled, or its failed sync was rerun later, which is
what the failure issue tells the operator to do — and the script mirrors the
skills wholesale, so that run would roll basecamp/skills back to the older skill.
The job now makes the check the manual Sync skills workflow already makes: the
tag must be the repository's latest stable release, or the sync is skipped with
a warning. A failed lookup fails the job, so the failure issue is filed rather
than the sync skipped in silence.
* Run the sync as the source its CLI_NAME default names
Every case set SYNC_SOURCE to play hey-cli or basecamp-cli, so the one line
this copy of the script changes — the CLI_NAME default — never ran. A last case
runs the script with neither SYNC_SOURCE nor CLI_NAME set and checks the
manifest it writes, the bot it commits as and the summary line against the
source the Makefile expects, fizzy-cli. A copy left at the seed's placeholder,
or naming another CLI, fails here instead of publishing under that source's
manifest and identity.
Mirrors seed/scripts/test-sync-skills.sh from basecamp/cli@19b52ed.
* Send the token as a github.com-scoped Authorization header, not a URL rewrite
Mirrors the seed (basecamp/cli#78 at 0649a4d); scripts/sync-skills.sh stays
byte-identical apart from the CLI_NAME default, scripts/test-sync-skills.sh
byte-identical.
The insteadOf rewrite kept the token out of the outer git argv and the remote
URL, but git expands the rewrite before invoking git-remote-https, so that helper
still received https://x-access-token:<token>@github.com/... as an argument. The
private gitconfig now carries http.https://github.com/.extraheader with the
basic-auth form actions/checkout writes: the helper sees the plain URL, and the
token lives only in the mode-600 file until the tmpdir goes.
The test unsets SKILLS_TOKEN up front: its token-required case points the script
at the real basecamp/skills, and a token inherited from the caller's environment
would have let it clone and publish the fixtures there.
The header now says exactly what the tombstone shields — the sources that have
upgraded — rather than "anyone's skills": a pre-fix sibling still rewrites
.managed-skills with its own names and a second pre-fix sibling still deletes
those, the basecamp/skills#5 clobber confined to the CLIs yet to upgrade.
* Say that make check runs the skills sync test too
echo "::warning::Skipping the skills sync for ${TAG}: the latest stable release is ${latest}, and syncing an older tag would roll basecamp/skills back."
BODY="The automatic skills sync to basecamp/skills for [${REF_NAME}](${RUN_URL}) failed. Check the workflow run for details; once fixed, rerun the failed jobs in that run or dispatch the Sync skills workflow for ${REF_NAME}."
231
+
232
+
# Filed on this repo (the only one github.token can write to), one
233
+
# open issue per outage. Deduped by label, not title: a title lookup
234
+
# misses the moment someone retitles the issue while triaging it.
235
+
# The lookup fails closed — an API error must not read as "no open
236
+
# issue" and file a duplicate; the annotation below still records
237
+
# the failure.
238
+
notify_status=0
239
+
if ! matches=$(gh issue list --repo "$REPO_SLUG" --state open --label "$LABEL" \
240
+
--json number --jq '[.[].number] | join(" ")'); then
241
+
echo "::error::Could not list open '${LABEL}' issues in ${REPO_SLUG}. Filing nothing rather than risk a duplicate."
242
+
notify_status=2
243
+
else
244
+
read -ra issues <<< "$matches"
245
+
case "${#issues[@]}" in
246
+
0)
247
+
echo "No open '${LABEL}' issue; filing one."
248
+
# --force makes this idempotent, so the label exists before the
249
+
# first issue carries it (gh issue create refuses an unknown label).
# Picking one arbitrarily would scatter one outage's history
261
+
# across issues a human already decided to keep separate.
262
+
echo "::error::${#issues[@]} open issues carry the '${LABEL}' label (${issues[*]}). Refusing to guess which one to update — consolidate them, then re-run."
263
+
notify_status=3
264
+
;;
265
+
esac
266
+
fi
267
+
268
+
echo "::error::Skills sync to basecamp/skills failed for ${REF_NAME}. See ${RUN_URL}"
0 commit comments