ci(zunit): test the pull request instead of the base branch - #12
Merged
Conversation
The workflow triggered on `pull_request_target' with a bare actions/checkout, which resolves to the base branch. Every pull request run therefore tested `main': on #11 it reported "6 tests run" while that branch has 9, and reported success without executing a single changed line. The job installs zunit from public sources and reads no secrets, so the plain `pull_request' trigger is both correct and the safer default.
There was a problem hiding this comment.
🟡 Changes recommended
Add explicit least-privilege workflow permissions, including at least contents: read.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Updates ZUnit CI to test pull-request changes instead of the base branch.
Changes:
- Replaces
pull_request_targetwithpull_request. - Documents the trigger rationale.
File summaries
| File | Summary |
|---|---|
.github/workflows/zunit.yml |
Corrects the trigger; explicit least-privilege token permissions are still required. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+12
to
13
| pull_request: | ||
| branches: [main] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
zunit.ymltriggers onpull_request_targetwith a bareactions/checkout.That combination resolves to the base branch, so every pull request run has
been testing
mainrather than the proposed change.Concretely, on #11 the ZUnit check reported:
while that branch contains 9 tests. It passed without executing a single changed
line, and it would have passed just as readily had the change been broken.
Change
Switch the trigger to
pull_request. The job installs zunit from public sources,reads no secrets, and needs no write token, so the plain trigger is both the
correct one and the safer default. A comment above the trigger records the
reasoning so it does not get switched back.
zsh-n.ymlandtrunk-check.ymlalready usepull_request; this was the onlyworkflow affected.
Note on verifying this
pull_request_targetevaluates the workflow file from the base branch, so thispull request's own ZUnit run still uses the old trigger and will still report 6
tests. The fix takes effect for pull requests opened after it merges. The first
PR after that should report the real count; #11 is a convenient one to re-run.