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
feat: sign pin commits and guard draft releases in the pin pr flow - #22
Replaces #21 (GitHub's PR head association broke when the branch was recreated; fresh PR from the same signed commits).
Root-cause fixes for the two manual-firefight loops this release cycle hit on every tag:
1. Signed pin commits. The workflow-authored pin commit was unsigned, so the default-branch commit-signature ruleset blocked every pin PR (#13/#19 both needed a manual signed re-author). open-spm-pr.sh now SSH-signs the pin commit when BOT_SIGNING_KEY (SSH private key) is configured — key written 0600, an EXIT trap removes it on every path (a failed signed commit can no longer strand the key), signing rides on one-shot -c options so no repo config is mutated. Without the secret the behavior is unchanged. release.yml passes the optional secret through.
Owner action to activate signing (one time): create an SSH keypair, register the public key as a signing key on the repository (or bot account), and add the private key as the BOT_SIGNING_KEY actions secret.
2. Draft-release guard. Hoisted to the input-validation section: the script verifies the release is published before ANY local mutation and fails closed with an actionable message (publish command included), instead of the opaque pin-gate refusal three days later.
Tests: suite extended 164 → 168 assertions (draft refusal + message, unreadable state fail-closed, signed commit invocation with one-shot signing config, unsigned fallback unchanged). actionlint + shellcheck clean. Addresses both review threads from #21.
⚠️ GitHub could not post this as an inline comment: Routed to summary (severity low · category maintainability)
Suppressing gh's stderr entirely (2>/dev/null) makes every failure mode — missing tag, transient API error, auth failure — report the same generic 'cannot verify the release state' message. During a real release this makes it hard to tell whether the tag was never pushed versus a transient GitHub outage. Consider capturing gh's output and including it in the error line, e.g. err="$(gh release view ... 2>&1)" || { echo "::error::cannot verify ...: ${err}"; exit 1; }.
💡 Suggested Change
Before:
release_is_draft="$(gh release view "${TAG}" --repo "${GITHUB_REPOSITORY}" \
--json isDraft --jq '.isDraft' 2>/dev/null)" \
|| { echo "::error::cannot verify the release state for $(esc "${TAG}")"; exit 1; }
After:
gh_err="$(gh release view "${TAG}" --repo "${GITHUB_REPOSITORY}" \
--json isDraft --jq '.isDraft' 2>&1)" \
|| { echo "::error::cannot verify the release state for $(esc "${TAG}"): ${gh_err}"; exit 1; }
release_is_draft="${gh_err}"
📄 scripts/release/open-spm-pr.sh (L75-L78)
⚠️ GitHub could not post this as an inline comment: Routed to summary (severity low · category maintainability)
When gh release view succeeds but .isDraft comes back empty (e.g., unexpected JSON shape or an empty jq result), this check fails with the message "release ${TAG} is a draft", which is factually wrong and can mislead during a real release. An empty value is an unknown state, not a draft; the error should distinguish it (e.g., "unexpected release state: ") or the empty case should fall into the "cannot verify" path.
💡 Suggested Change
Before:
if [ "${release_is_draft}" != "false" ]; then
echo "::error::release $(esc "${TAG}") is a draft; publish it (gh release edit $(esc "${TAG}") --draft=false) before opening the pin pr"
exit 1
fi
After:
if [ -z "${release_is_draft}" ]; then
echo "::error::cannot verify the release state for $(esc "${TAG}")"
exit 1
fi
if [ "${release_is_draft}" != "false" ]; then
echo "::error::release $(esc "${TAG}") is a draft; publish it (gh release edit $(esc "${TAG}") --draft=false) before opening the pin pr"
exit 1
fi
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
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.
Replaces #21 (GitHub's PR head association broke when the branch was recreated; fresh PR from the same signed commits).
Root-cause fixes for the two manual-firefight loops this release cycle hit on every tag:
1. Signed pin commits. The workflow-authored pin commit was unsigned, so the default-branch commit-signature ruleset blocked every pin PR (#13/#19 both needed a manual signed re-author).
open-spm-pr.shnow SSH-signs the pin commit whenBOT_SIGNING_KEY(SSH private key) is configured — key written 0600, an EXIT trap removes it on every path (a failed signed commit can no longer strand the key), signing rides on one-shot-coptions so no repo config is mutated. Without the secret the behavior is unchanged.release.ymlpasses the optional secret through.Owner action to activate signing (one time): create an SSH keypair, register the public key as a signing key on the repository (or bot account), and add the private key as the
BOT_SIGNING_KEYactions secret.2. Draft-release guard. Hoisted to the input-validation section: the script verifies the release is published before ANY local mutation and fails closed with an actionable message (publish command included), instead of the opaque pin-gate refusal three days later.
Tests: suite extended 164 → 168 assertions (draft refusal + message, unreadable state fail-closed, signed commit invocation with one-shot signing config, unsigned fallback unchanged). actionlint + shellcheck clean. Addresses both review threads from #21.