Skip to content

fix(ci): record checkout SHA from the checkout action output - #2056

Merged
gerchowl merged 3 commits into
release/1.19.0from
bugfix/2055-checkout-sha-output
Nov 6, 2026
Merged

gerchowl merged 3 commits into
release/1.19.0from
bugfix/2055-checkout-sha-output

Conversation

@gerchowl

@gerchowl gerchowl commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Description

#2031 added a Record checkout SHA step (CHECKOUT_SHA=$(git rev-parse HEAD)) right after actions/checkout and before Set up devkit toolchain. In a container: job, git refuses the workspace as "dubious ownership" (exit 128) until setup-devkit-toolchain marks it a safe.directory. That broke the 1.19.0-rc4 smoke test (Prepare Release run 42151390302). This PR takes the SHA from actions/checkout's documented commit output, so no git call is needed. Release blocker for 1.19.0 (#2033).

Type of Change

  • fix -- Bug fix
  • test -- Adding or updating tests

Modifiers

  • Breaking change (!) -- This change breaks backward compatibility

Changes Made

  • 15 captures that directly follow actions/checkout (devkit .github/workflows: prepare-release ×2, prepare-release-extension, prepare-hotfix, release, abandon-release, sync-issues, update-nixpkgs, update-nixpkgs-unstable; consumer assets/workspace/.github/workflows: prepare-release ×2, prepare-hotfix, release-core, abandon-release, sync-issues):
    • The checkout step gets id: checkout.
    • The capture reads CHECKOUT_SHA: ${{ steps.checkout.outputs.commit }} through env:. Nothing is interpolated into run:.
    • It fails closed (::error::, exit 1) when the output is empty.
    • The step id checkout-state, the output sha, every BASE_SHA consumer and the Require pinned commit base guards are unchanged.
    • actions/checkout@3d3c42e5 (v7.0.1) declares outputs.commit in its action.yml. src/git-source-provider.ts sets it from git log -1 --format=%H after checkout.
  • 3 captures left on git rev-parse on purpose: the extension's dev fallback (dev-checkout-state) and sync-main-to-dev in both trees.
    • Each follows a later manual git checkout step, so HEAD is no longer the commit actions/checkout reported, and that output would be the wrong base.
    • They run after the toolchain/safe-directory setup. The new ordering scan proves this for the container job.
  • New guard tests/test_workflow_checkout_sha.py scans every workflow in both trees:
    • In every job with a container: key, no run: step may invoke git before the step that sets safe.directory. That step is ./.github/actions/setup-devkit-toolchain, whose "Configure in-container toolchain env" step runs git config --global --add safe.directory "$GITHUB_WORKSPACE"; the test asserts that line exists.
    • Every Record checkout SHA after actions/checkout must read that step's commit output, use no git and fail closed when it is empty.
    • Anything else must follow a manual git checkout.
    • It checks that the scan is not vacuous: at least 20 container jobs and exactly 18 captures.
  • fix(ci): pin API file commits to checkout revisions #2031/prepare-release: dev CHANGELOG commit can revert concurrent entries (no BASE_SHA) #2028 replay tests (test_commit_action_base_sha.py, test_abandon_release.py) now seed the checkout commit output. The fail-closed tests check that an empty output stops the job with exit 1 (git-based captures still surface git's exit code).
  • docs/RELEASE_CYCLE.md documents the capture rule and the reason for the exception.

Changelog Entry

Under ## [1.19.0] - TBD → ### Fixed (release branch):

  • Record checkout SHAs without git in container jobs (#2055)
    • Take the API commit base from actions/checkout's commit output, so Prepare Release, Prepare Hotfix, Release and Sync Issues no longer fail with "dubious ownership" (exit 128) in devcontainer/both mode.
    • Fail closed when the checkout reports no commit; a static guard rejects any container job that runs git before its safe.directory setup.

Testing

  • Tests pass locally (touched suites only; CI runs the rest)
  • Manual testing performed (describe below)

Manual Testing Details

  • RED on base (commit test(ci): ...): pytest tests/test_workflow_checkout_sha.py gave 20 failed and 23 passed, exit 1. The failures were 5 container jobs running git before safe.directory (consumer prepare-hotfix:prepare, prepare-release:prepare and :rollback, release-core:finalize, sync-issues:sync) and 15 captures.
  • GREEN: the new guard plus test_commit_action_base_sha.py and test_abandon_release.py gave 181 passed, exit 0.
  • All 63 non-container, non-nix test files that read these workflows (scaffold drift/pin and workflow shape suites included) gave 2365 passed and 4 skipped, exit 0.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • I have updated CHANGELOG.md (release section, per release-branch fix) and pasted the entry above
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

Targets release/1.19.0, not dev: it fixes the 1.19.0 release candidate. After merge, the next RC smoke run is the end-to-end proof.

Refs: #2055

@gerchowl
gerchowl requested a review from c-vigo as a code owner November 6, 2026 03:07
@gerchowl
gerchowl merged commit bbc840c into release/1.19.0 Nov 6, 2026
16 checks passed
@gerchowl
gerchowl deleted the bugfix/2055-checkout-sha-output branch November 6, 2026 03:29
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