Skip to content

Allow checkout of a different repository and ref in plan/apply#23

Merged
gsavage merged 3 commits into
mainfrom
allow-checkout-of-different-repository
Jun 25, 2026
Merged

Allow checkout of a different repository and ref in plan/apply#23
gsavage merged 3 commits into
mainfrom
allow-checkout-of-different-repository

Conversation

@gsavage

@gsavage gsavage commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

The base workflow checks out the repository that initiated the run, which works for Kosli (each repository calls the workflow for its own Terraform code) but breaks for orchestrators such as the CyberDojo production deployment system, where a single repository iterates over several repositories and runs apply.yml for each.

This PR adds two optional inputs, threaded through plan.yml and apply.yml into base.yml:

  • github_repository_to_checkout — the repository (owner/name) to check out. Defaults to ${{ github.repository }}, so existing callers are unaffected. The reset-drift-detection checkout in apply.yml honours it too, so Kosli attestations reference the repository that was actually applied.
  • ref — the git reference (branch, tag or SHA) to check out. base.yml already accepted this, but plan.yml/apply.yml neither exposed nor forwarded it. Defaults to "" (the default branch).

Together these let an orchestrator point a plan/apply at a specific repository pinned to a specific git tag or SHA.

Notes

  • CyberDojo's target repositories are public, so the default GITHUB_TOKEN can check them out — no extra token input needed.

🤖 Generated with Claude Code

gsavage and others added 3 commits June 25, 2026 09:54
The base workflow checks out the repository that initiated the run.
This works for Kosli, where each repository calls the workflow for its
own Terraform code, but breaks for orchestrators such as the CyberDojo
production deployment system, where a single repository iterates over
several repositories and runs apply.yml for each.

Add an optional github_repository_to_checkout input to the base, plan
and apply workflows, defaulting to ${{ github.repository }} so existing
callers are unaffected. Callers can now point the checkout at a specific
repository.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The reset-drift-detection job's checkout previously always used the
repository that initiated the run. The Kosli attest steps in this job
read the local git repository for commit metadata, so for an
orchestrator such as the CyberDojo production deployment system the
attestations would have referenced the orchestrator's commit rather
than the target repository's.

Make this checkout honour github_repository_to_checkout, matching the
checkout in base.yml, so the attestations reference the repository that
was actually applied.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The base workflow already accepts a ref input to check out a specific
git reference, but the plan and apply workflows neither exposed nor
forwarded it, so callers had no way to reach it.

Add a ref input to both workflows and pass it through to base.yml. Also
apply it to the reset-drift-detection checkout so its Kosli attestations
reference the same git reference that was applied. This lets an
orchestrator such as the CyberDojo production deployment system pin a
deployment to a specific git tag or SHA.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@gsavage gsavage merged commit 243cd30 into main Jun 25, 2026
1 check passed
@gsavage gsavage deleted the allow-checkout-of-different-repository branch June 25, 2026 09:14
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