Skip to content

Expose the oid of the commit, so a caller can name what it just committed - #3

Merged
barnumbirr merged 1 commit into
masterfrom
tech/expose-commit-sha
Sep 14, 2026
Merged

Expose the oid of the commit, so a caller can name what it just committed#3
barnumbirr merged 1 commit into
masterfrom
tech/expose-commit-sha

Conversation

@barnumbirr

Copy link
Copy Markdown
Contributor

commit-branch.sh already parsed the oid out of the GraphQL response and threw
it away after logging its first twelve characters. It now reaches the caller as
a step output, and action.yml declares it.

Why

A caller that has to act on the commit could previously only ask GitHub to
resolve the branch again by name, and GitHub can still resolve a branch to its
previous tip for seconds after the mutation lands.

pkghaus/packages dispatched a release that way on 2026-09-13. The run checked
out the parent of the commit it was meant to release, read the pre-bump
changelog, derived a tag that already existed, planned nothing and went green.
The archive served the previous version of ouch for twelve hours.

Behaviour

  • sha is the full oid, not the truncated form the log prints.
  • Empty when nothing was committed, which is distinct from a failure: a failure
    exits non-zero and emits nothing, because the assignment that captures the oid
    takes the parser's exit status.
  • An unset GITHUB_OUTPUT is a no-op, so local runs and the test suite are
    unaffected.

Blast radius

Additive. pkghaus/apt and pkghaus/brand consume this action and neither
reads the new output, so both are unaffected by the change itself.

Moving the v1 tag onto this commit is what arms it, and pkghaus/packages
depends on that tag having moved. Merge and retag here BEFORE merging the
matching change in pkghaus/packages, or that repo's bump will refuse to
dispatch a release.

Tests

tests/run.sh goes from 8 assertions to 13. tests/lint-action.sh gains an
assertion that every declared output reads from the step's id, since an output
wired to nothing resolves to the empty string forever and looks exactly like a
commit that changed nothing.

Mutation-checked: emitting the truncated oid, dropping the empty-sha report on
an unchanged tree, and dropping the signature check are each caught by the
suite.

…tted

commit-branch.sh already parsed the oid out of the GraphQL response and threw
it away after logging its first twelve characters. It now reaches the caller as
a step output, and action.yml declares it.

A caller that has to act on the commit could previously only ask GitHub to
resolve the branch again by name, and GitHub can still resolve a branch to its
previous tip for seconds after the mutation lands. pkghaus/packages dispatched
a release that way on 2026-09-13, the run checked out the parent of the commit
it was meant to release, and the archive stayed a version behind for twelve
hours.

The output is empty when nothing was committed, which is distinct from a
failure: a failure exits non-zero and emits nothing, because the assignment
that captures the oid takes the parser's exit status.

lint-action.sh now also asserts every declared output reads from the step's id.
Without that an output wired to nothing resolves to the empty string forever,
which is indistinguishable from a commit that changed nothing.
@barnumbirr
barnumbirr merged commit 56d30c4 into master Sep 14, 2026
1 check passed
@barnumbirr
barnumbirr deleted the tech/expose-commit-sha branch September 14, 2026 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant