Repository navigation
ci(lstt): run formatting on develop pushes, not just PRs - #11000
Conversation
✅ All Policy Checks Passed
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
- Run the pre-commit job on pushes to develop, diffing the commit range that just landed, so whole-tree hooks report against the merge that introduced a violation instead of the next unrelated pull request - Stop cancelling in-progress runs outside pull requests so back-to-back merges each keep their own verdict Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
6ea7f09 to
20f30c7
Compare
|
claude: rebase looks right — only the workflow change is left, the headers landed independently via #8561. Two things from testing it:
FWIW |
|
claude: correcting myself — I wrote in the description that develop has no branch protection because the protection API 404s. That was wrong: protection is a ruleset (id 9297053), which the legacy API does not report. Description fixed. The recommendation stands and is now exact: the ruleset does have Two related facts, since they came up: the required contexts are only |
## Motivation `amdsmi-license-headers` is `pass_filenames: false`, so it rescans the whole tree. Once a violation lands on `develop`, every later PR goes red instead of the merge that caused it. #10010 merged on a stale-green formatting run and reddened #10973 and #10998 until #8561 fixed the headers. Third time against this hook (#10402, #10845, #8561), each fixed reactively. ## Technical Details `.github/workflows/lstt-formatting.yml`: - `push` trigger on `develop`, same path filter as `pull_request`, so a whole-tree hook runs on the merge commit. - `--from-ref` is event-aware via `FROM_REF`: `github.event.before` on push, base branch on PR. PR behavior unchanged. - `cancel-in-progress` limited to `pull_request`, so consecutive merges each keep their verdict. Detection at merge, not prevention. Prevention is "Require branches to be up to date before merging". `develop`'s ruleset has `required_status_checks` with `strict_required_status_checks_policy: false`, so a PR can merge on a check that last ran against an older base — which is how the stale-green merge happened. Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
## Motivation `amdsmi-license-headers` is `pass_filenames: false`, so it rescans the whole tree. Once a violation lands on `develop`, every later PR goes red instead of the merge that caused it. #10010 merged on a stale-green formatting run and reddened #10973 and #10998 until #8561 fixed the headers. Third time against this hook (#10402, #10845, #8561), each fixed reactively. ## Technical Details `.github/workflows/lstt-formatting.yml`: - `push` trigger on `develop`, same path filter as `pull_request`, so a whole-tree hook runs on the merge commit. - `--from-ref` is event-aware via `FROM_REF`: `github.event.before` on push, base branch on PR. PR behavior unchanged. - `cancel-in-progress` limited to `pull_request`, so consecutive merges each keep their verdict. Detection at merge, not prevention. Prevention is "Require branches to be up to date before merging". `develop`'s ruleset has `required_status_checks` with `strict_required_status_checks_policy: false`, so a PR can merge on a check that last ran against an older base — which is how the stale-green merge happened. Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
TheRock Submodule Bump ActivityNewest first
|
Motivation
amdsmi-license-headersispass_filenames: false, so it rescans the whole tree.Once a violation lands on
develop, every later PR goes red instead of the mergethat caused it. #10010 merged on a stale-green formatting run and reddened #10973
and #10998 until #8561 fixed the headers. Third time against this hook (#10402,
#10845, #8561), each fixed reactively.
Technical Details
.github/workflows/lstt-formatting.yml:pushtrigger ondevelop, same path filter aspull_request, so a whole-treehook runs on the merge commit.
--from-refis event-aware viaFROM_REF:github.event.beforeon push, basebranch on PR. PR behavior unchanged.
cancel-in-progresslimited topull_request, so consecutive merges each keeptheir verdict.
Detection at merge, not prevention. Prevention is "Require branches to be up to
date before merging".
develop's ruleset hasrequired_status_checkswithstrict_required_status_checks_policy: false, so a PR can merge on a check thatlast ran against an older base — which is how the stale-green merge happened.
Known gap:
github.event.beforeis unguarded, so a branch re-create or force-pushgives
pre-commita zero/unreachable SHA and it exits 128. Loud, not silent.Follow-up can fall back to the base branch on
github.event.created/forced.JIRA ID
N/A (CI hygiene). Drift origin #10010, headers fixed by #8561.
Test Plan / Result
pre-commit run --from-ref origin/develop --to-ref HEADinprojects/amdsmi— passes.python3 projects/amdsmi/tests/check_license_headers.py— clean.FROM_REFgivesgithub.event.beforeon push andorigin/<base>on PR;cancel-in-progressisfalse on push, true on PR.
pre-commit run --from-ref 0000000000000000000000000000000000000000reproducesthe exit-128 gap above.