Skip to content

Container tests: check out the built SHA; document org scope (#37) - #42

Merged
mmcky merged 1 commit into
mainfrom
fix/container-test-checkout-sha
Jun 16, 2026
Merged

mmcky merged 1 commit into
mainfrom
fix/container-test-checkout-sha

Conversation

@mmcky

@mmcky mmcky commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Addresses #37 (M11/M12/M13) — the container test workflows ran against the wrong commit on workflow_run, plus a note on the hardcoded org.

M11/M12 — check out the commit that built the image (the real fix)

Both test workflows trigger on workflow_run after Build QuantEcon Containers. For workflow_run events actions/checkout defaults to the default branch, not the SHA that triggered the build — so the test files / composite actions could be from a different commit than the one that produced the image under test.

Pinned the checkout to:

ref: ${{ github.event.workflow_run.head_sha || github.sha }}
  • workflow_run.head_sha for the triggered runs;
  • falls back to github.sha for manual workflow_dispatch.

Applied to:

  • test-container.yml — both job checkouts (full + lean).
  • test-containers-lectures.yml — the actions-repo checkout only. The lecture-repo checkout deliberately keeps its default (it tracks lecture content, which isn't tied to the container build commit).

M13 — hardcoded quantecon org → documented (not parameterised)

I resolved this via the issue's "document it" option rather than substituting github.repository_owner, because that substitution would actually break: GHCR image paths must be lowercase, but github.repository_owner preserves the org's casing (QuantEcon), and it can't be lowercased inside a job-level container.image. The workflows also target QuantEcon's public lecture repos in the matrix, so they're QuantEcon-specific by design. Added a header comment to each workflow explaining this (and what a fork would change).

Verification

  • Both workflows validated as YAML.
  • head_sha ref present in both; the lecture-repo checkout confirmed unchanged.

Closes #37

🤖 Generated with Claude Code

- M11/M12: on workflow_run, actions/checkout defaults to the default branch,
  not the commit that triggered the container build — so tests could run
  against a different commit than the one that built the image. Pin the
  checkout to `${{ github.event.workflow_run.head_sha || github.sha }}`
  (head_sha for workflow_run, github.sha for manual workflow_dispatch).
  - test-container.yml: both job checkouts.
  - test-containers-lectures.yml: the actions-repo checkout only. The
    lecture-repo checkout intentionally stays on its own default branch
    (it tracks lecture content, not the container build commit).
- M13: documented that these workflows target the `quantecon` GHCR org and
  QuantEcon's public lecture repos by design. github.repository_owner can't be
  substituted into the job-level container image because GHCR requires a
  lowercase path while the expression preserves the org's casing, so forks
  would set the org explicitly.

Closes #37

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Copilot AI review requested due to automatic review settings June 16, 2026 02:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the container test workflows triggered via workflow_run so they test against the same commit that built the container image, and it documents that these workflows intentionally target the quantecon GHCR org (i.e., they’re QuantEcon-specific).

Changes:

  • Pin actions/checkout to ${{ github.event.workflow_run.head_sha || github.sha }} so workflow_run tests use the triggering commit instead of the default branch.
  • Add workflow header comments documenting the hardcoded ghcr.io/quantecon/... scope and implications for forks.
  • Add a corresponding CI note to the changelog.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
CHANGELOG.md Documents the CI fix so release notes reflect the workflow_run checkout behavior change.
.github/workflows/test-container.yml Pins checkout to the image-building SHA for both full/lean test jobs; documents QuantEcon-only GHCR scope.
.github/workflows/test-containers-lectures.yml Pins the actions-repo checkout to the image-building SHA; documents QuantEcon-only GHCR scope.

@mmcky
mmcky merged commit 091b813 into main Jun 16, 2026
1 check passed
@mmcky
mmcky deleted the fix/container-test-checkout-sha branch June 16, 2026 03:05
mmcky added a commit that referenced this pull request Jun 16, 2026
Follow-up to #42: the M13 note explained fork behaviour at length. Forks
aren't a concern, so reduce it to a one-line guard that keeps the useful
bit — don't substitute github.repository_owner for the hardcoded org (GHCR
paths must be lowercase).

Co-authored-by: Claude Opus 4.8 <[email protected]>
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.

Container test workflows: checkout the built SHA + de-hardcode org

2 participants