Skip to content

Use self-repository syntax for in-repo action references - #1307

Closed
brunoborges wants to merge 2 commits into
actions:mainfrom
brunoborges:brunoborges-fix-code-scanning-alerts
Closed

brunoborges wants to merge 2 commits into
actions:mainfrom
brunoborges:brunoborges-fix-code-scanning-alerts

Conversation

@brunoborges

Copy link
Copy Markdown
Contributor

Description:
zizmor's self-repository audit flagged 50 workflow steps that reference this action with workspace-relative uses: ./... (code scanning alerts #136-#186, e.g. #160). Workspace-relative references resolve against whatever is on disk at runtime, so an earlier step could swap in a different action. They also don't count as pinned under GitHub's "require full-length SHA" policy. The new self-repository syntax (uses: $/) always resolves to the repository at the running commit.

  • e2e workflows (43 alerts): uses: ./ -> uses: $/ in e2e-cache.yml, e2e-local-file.yml, e2e-publishing.yml, e2e-smoke.yml, and e2e-versions.yml. None of these jobs check out another ref or build the action before using it, so they still test the same code.
  • benchmark-cache-restore.yml (7 alerts): these steps intentionally load the action from runtime checkouts of the user-supplied baseline-ref / candidate-ref (./baseline, ./candidate). $/ can't express that, so those lines get inline # zizmor: ignore[self-repository] comments, with a short note at the top of the file explaining why.

Things to watch:

  • $/ requires runner 2.336.0 or newer and is not available on GHES. That's fine for these github.com CI workflows. A self-hosted runner would need checking.
  • Running zizmor 1.31.1 locally on .github/workflows/ now reports no findings (7 intentionally ignored). The alerts close once zizmor runs on main.

Related issue:
N/A. Addresses zizmor self-repository code scanning alerts #136-#186.

Check list:

  • Ran npm run check locally (format, lint, build, test) and all checks pass.
  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

Replace workspace-relative `uses: ./` with the self-repository
`uses: $/` syntax in the e2e workflows so the action under test always
resolves to the running commit rather than runtime filesystem state,
resolving the zizmor/self-repository code scanning alerts.

The cache restore benchmark intentionally loads baseline and candidate
actions from runtime checkouts of user-supplied refs, which `$/` cannot
express, so those references are explicitly exempted.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 30, 2026 15:44
@brunoborges
brunoborges requested a review from a team as a code owner October 30, 2026 15: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.

🟢 Approval recommended

No active review issues are recorded for the workflow action-reference updates.

No open issues 🎉

What changed in this PR

This PR updates setup-java’s CI workflows to use self-repository action references, resolving the action from the running commit rather than mutable workspace files.

Changes:

  • Replaces 43 uses: ./ references with uses: $/ across five end-to-end workflows.
  • Preserves seven runtime-checkout references in the benchmark workflow, adding targeted zizmor suppressions and a comment explaining why they are necessary.
File Description
.github/​workflows/​e2e-versions.yml Uses self-repository references for Java version and distribution tests.
.github/​workflows/​e2e-smoke.yml Updates the smoke-test action reference.
.github/​workflows/​e2e-publishing.yml Updates action references in publishing configuration tests.
.github/​workflows/​e2e-local-file.yml Updates action references for local JDK installation tests.
.github/​workflows/​e2e-cache.yml Updates action references throughout dependency-cache tests.
.github/​workflows/​benchmark-cache-restore.yml Documents and suppresses audit warnings for intentional runtime-checkout references.

Review effort: Balanced

@brunoborges
brunoborges marked this pull request as draft October 30, 2026 15:52
@brunoborges brunoborges self-assigned this Oct 30, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@brunoborges
brunoborges marked this pull request as ready for review October 30, 2026 16:58
@brunoborges

Copy link
Copy Markdown
Contributor Author

Closing without merging. The self-repository uses: $/ syntax is not yet supported on GitHub Enterprise Server and requires runner 2.336.0 or newer. setup-java has users on GitHub Enterprise and self-hosted runners, so we can't apply these changes yet. The related zizmor self-repository code scanning alerts are being dismissed as won't fix; we can revisit once GHES supports the syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants