Repository navigation
fix(workflows): branch protection status checks fail when workflow uses on: paths filter - #38237
Conversation
|
could you fix the tests and conflicts? |
|
oh wonder why the tests are failing will report back |
Conflicts, should i create a merge commit? or any other workflow to be followed |
yes please |
…status-filter # Conflicts: # services/actions/notifier_helper.go # services/actions/run.go
|
@bircni made the changes, I have updated test cases accordingly as well so let me know if you want any behavioral changes |
|
will check |
|
right the grep did not find detectWorkflow, and maybe missed that change while merging |
|
Some logic related to scoped workflows needs to be adjusted. I will check it and make some updates. |
|
looks good to me, I went with the approach to create skipped status runs because i thought github also did that, apparently not. |
Seems like GitHub still hasn't addressed this issue😆 |
* 'main' of https://github.com/go-gitea/gitea: (24 commits) [skip ci] Updated translations via Crowdin fix(actions): make runner list pagination order deterministic (go-gitea#38313) fix(release): gate draft release attachments on web download endpoints (go-gitea#38318) ci(snap): build snaps natively instead of on launchpad (go-gitea#38312) chore: update `eslint-plugin-unicorn` to v70 (go-gitea#38310) feat(webhook): support Telegram Bot API 10.1 Rich Messages (go-gitea#38298) chore(snap): drop `armhf` build (go-gitea#38311) fix(actions): prevent chevron overlap with log text when timestamps are enabled (go-gitea#38227) chore: upgrade `go-swagger` to v0.35.0 and enforce zero swagger warnings (go-gitea#38299) fix: Improve since/until when counting commits for X-Total-Count (go-gitea#38243) chore: remove eslint-plugin-array-func (go-gitea#38294) docs: Welcome Zettat to TOC (go-gitea#38303) fix(workflows): branch protection status checks fail when workflow uses on: paths filter (go-gitea#38237) chore: update node.js to v26 (go-gitea#38285) refactor: replace `vue-bar-graph` dependency with inlined SVG chart (go-gitea#38292) feat(auth): add `disable-2fa` command (go-gitea#38275) fix(oauth2): persist linkAccountData during auto-link 2FA flow (go-gitea#38274) fix(actions): allow Actions bot to push to protected branches (go-gitea#38284) [skip ci] Updated translations via Crowdin feat: extend <video> tag allowed attributes (go-gitea#38279) ...
* main: (24 commits) [skip ci] Updated translations via Crowdin fix(actions): make runner list pagination order deterministic (go-gitea#38313) fix(release): gate draft release attachments on web download endpoints (go-gitea#38318) ci(snap): build snaps natively instead of on launchpad (go-gitea#38312) chore: update `eslint-plugin-unicorn` to v70 (go-gitea#38310) feat(webhook): support Telegram Bot API 10.1 Rich Messages (go-gitea#38298) chore(snap): drop `armhf` build (go-gitea#38311) fix(actions): prevent chevron overlap with log text when timestamps are enabled (go-gitea#38227) chore: upgrade `go-swagger` to v0.35.0 and enforce zero swagger warnings (go-gitea#38299) fix: Improve since/until when counting commits for X-Total-Count (go-gitea#38243) chore: remove eslint-plugin-array-func (go-gitea#38294) docs: Welcome Zettat to TOC (go-gitea#38303) fix(workflows): branch protection status checks fail when workflow uses on: paths filter (go-gitea#38237) chore: update node.js to v26 (go-gitea#38285) refactor: replace `vue-bar-graph` dependency with inlined SVG chart (go-gitea#38292) feat(auth): add `disable-2fa` command (go-gitea#38275) fix(oauth2): persist linkAccountData during auto-link 2FA flow (go-gitea#38274) fix(actions): allow Actions bot to push to protected branches (go-gitea#38284) [skip ci] Updated translations via Crowdin feat: extend <video> tag allowed attributes (go-gitea#38279) ...
… required contexts (#38371) Follow #38237 #38237 posts "skipped" commit statuses for every workflow that is not triggered due to a filter (e.g. `paths` or `branches`) mismatch. However, for non-required workflows, creating "skipped" commit statuses for them would generate a lot of noise. To address this issue, this PR adds a check before creating commit status: - For the context that matches any required status check patterns, a "skipped" commit status will be created. The `Required` label can inform users that this status check is required, but has been skipped because of a filter mismatch. - For a non-required context, nothing will be created. NOTE: Reducing noise is a best-effort approach and isn't entirely accurate. When creating commit statuses, it is impossible to predict which branch protection rule will take effect. Therefore, we have to compare the commit status context against the required patterns from all rules. If any rule matches, the context is considered "required".
… required contexts (#38371) (#38385) Backport #38371 by @Zettat123 Follow #38237 #38237 posts "skipped" commit statuses for every workflow that is not triggered due to a filter (e.g. `paths` or `branches`) mismatch. However, for non-required workflows, creating "skipped" commit statuses for them would generate a lot of noise. To address this issue, this PR adds a check before creating commit status: - For the context that matches any required status check patterns, a "skipped" commit status will be created. The `Required` label can inform users that this status check is required, but has been skipped because of a filter mismatch. <img width="800" alt="image" src="/api/public/p/aHR0cHM6Ly9naXRodWIuY29tL2dvLWdpdGVhL2dpdGVhL3B1bGwvJTNDYSUyMGhyZWY9"/api/public/p/aHR0cHM6Ly9naXRodWIuY29tL3VzZXItYXR0YWNobWVudHMvYXNzZXRzLzI2NGZkNzE2LTQxM2MtNDU3ZC1hNWE2LTY3MTcxNzVkMzgwNw">https://github.com/user-attachments/assets/264fd716-413c-457d-a5a6-6717175d3807" /> - For a non-required context, nothing will be created. NOTE: Reducing noise is a best-effort approach and isn't entirely accurate. When creating commit statuses, it is impossible to predict which branch protection rule will take effect. Therefore, we have to compare the commit status context against the required patterns from all rules. If any rule matches, the context is considered "required". Closes #38351 Co-authored-by: Zettat123 <zettat123@gmail.com>
…es on: paths filter (go-gitea#38237)
… required contexts (go-gitea#38371) Follow go-gitea#38237 go-gitea#38237 posts "skipped" commit statuses for every workflow that is not triggered due to a filter (e.g. `paths` or `branches`) mismatch. However, for non-required workflows, creating "skipped" commit statuses for them would generate a lot of noise. To address this issue, this PR adds a check before creating commit status: - For the context that matches any required status check patterns, a "skipped" commit status will be created. The `Required` label can inform users that this status check is required, but has been skipped because of a filter mismatch. - For a non-required context, nothing will be created. NOTE: Reducing noise is a best-effort approach and isn't entirely accurate. When creating commit statuses, it is impossible to predict which branch protection rule will take effect. Therefore, we have to compare the commit status context against the required patterns from all rules. If any rule matches, the context is considered "required".
Closes #36895
Problem
When a workflow's event matches (e.g.
pull_requestorpush) but it is excluded bypaths,paths-ignore,branches, orbranches-ignore, no run was created. Because no run existed, no commit status was emitted, leaving required checks stuck atCommitStatusPending.Solution
detectNotApplicable,detectFilteredOutanddetectMatchedto differentiate between filters and not applicable.CommitStatusSkippedfor the filtered workflows to make required checks passTesting
Performed manual testing and skipped status check is shown
