Skip to content

ci(zunit): test the pull request instead of the base branch - #12

Merged
ss-o merged 1 commit into
mainfrom
ci/zunit-tests-the-pull-request
Sep 12, 2026
Merged

ci(zunit): test the pull request instead of the base branch#12
ss-o merged 1 commit into
mainfrom
ci/zunit-tests-the-pull-request

Conversation

@ss-o

@ss-o ss-o commented Sep 12, 2026

Copy link
Copy Markdown
Member

Problem

zunit.yml triggers on pull_request_target with a bare actions/checkout.
That combination resolves to the base branch, so every pull request run has
been testing main rather than the proposed change.

Concretely, on #11 the ZUnit check reported:

6 tests run in 430ms
✔ Passed      6

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.yml and trunk-check.yml already use pull_request; this was the only
workflow affected.

Note on verifying this

pull_request_target evaluates the workflow file from the base branch, so this
pull 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.

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.
Copilot AI lite review requested due to automatic review settings September 12, 2026 08:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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_target with pull_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]
@ss-o
ss-o merged commit 67df2d9 into main Sep 12, 2026
8 checks passed
@ss-o
ss-o deleted the ci/zunit-tests-the-pull-request branch September 12, 2026 09:06
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.

2 participants