ci: avoid duplicate feature branch push runs - #2228
Conversation
There was a problem hiding this comment.
Review: ci: avoid duplicate feature branch push runs
The branch-narrowing half of this change is correct and achieves the stated goal: restricting push.branches to main means feature-branch pushes are no longer double-run (they're now covered only by pull_request).
However, the same diff also adds tags: ["*"] to all 9 workflows, and this introduces a new class of redundant runs that works against the PR's own goal.
Main issue — heavy CI now runs on every tag push (high confidence)
Previously the branches: ["**", "!dependabot/**", "!xgopilot/**"] filter matched branch pushes only and never fired on tags. Only release-build.yml legitimately consumes tags (its release job is gated by if: startsWith(github.ref, 'refs/tags/')). The other 8 workflows have no tag-specific logic, so adding tags: ["*"] means:
- Release tags in this repo are pushed on top of a commit already on
main. That commit already ran full CI on themainpush; the tag push now re-runs the identical matrices a second time over the same tree. - The two heaviest workflows (
go.yml,llgo.yml— 60-minute matrices, WAMR-from-source, coverage, etc.) are the ones re-run. - The concurrency groups are keyed on
github.event.pull_request.number || github.ref, andrefs/tags/<tag>≠refs/heads/main, so these runs are not deduped/cancelled against themainpush — they run concurrently. "*"matches any single-segment tag, not just release tags (v*), so even ad-hoc/non-release tags will spin up the full matrices.
Recommendation: Keep tags: ["*"] only on release-build.yml. Drop the added tags: block from the other 8 workflows and keep just branches: [main] under push. (If some of them genuinely need to run at release time, prefer tags: ["v*"] and/or a per-job refs/tags/ gate rather than running the whole matrix on every tag.)
Minor, supporting:
.github/workflows/go.ymluploads coverage usingsecrets.CODECOV_TOKEN(lines 102, 206). With the new tag trigger, this will now push coverage to Codecov on every tag push as well — another consequence of the blankettagsaddition..github/workflows/doc-link-checker.ymlalready restricts topaths: ["README.md"]and runs on a daily schedule; atagstrigger for a link checker is almost certainly unintended.
No security-scanning coverage is lost (there is no CodeQL/security workflow among the changed files), fork-PR secret exposure is unchanged (all use pull_request, not pull_request_target), and no documentation references the old branch-filter behavior.
Inline comments are on the representative/heaviest files; the same tags: addition applies to build-cache.yml, doc.yml, fmt.yml, stdlib-coverage.yml, and targets.yml as well.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Feature branches in forks currently run the full CI suite twice when they have an open upstream PR: once for the fork
pushevent and again for the upstreampull_requestevent.Direct evidence from PR #2036, commit
8fc1aa05c8:6710edbf18and7b1cfbc1baDoc Link Checkerwas not included in that count because those commits did not changeREADME.md; it can be a ninth duplicated workflow when its path filter matches.This PR narrows feature-branch push triggers while preserving the existing tag behavior:
pushonly formainrelease-build.ymlruns onpushformainand tagspull_requestbranchAfter pushing this branch, the fork produced no feature-branch
pushruns, confirming the narrowed trigger works. The upstream PR continues to receive the completepull_requestCI suite.Validation:
release-build.ymlpull_request.branches: ["**"]for all nine changed workflowsgit diff --check