Skip to content

Switch PR label and title validation workflows to pull_request - #616

Merged
Michael Kubacki (makubacki) merged 1 commit into
microsoft:mainfrom
makubacki:pull_request_workflows
Oct 28, 2026
Merged

Michael Kubacki (makubacki) merged 1 commit into
microsoft:mainfrom
makubacki:pull_request_workflows

Conversation

@makubacki

@makubacki Michael Kubacki (makubacki) commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

This PR moves two worfklows off the pull_request_target trigger to pull_request. A complementary PR will be made in mu_basecore as well.


The label and PR formatting leaf workflows used pull_request_target so they could use the GitHub App token.

They now trigger on pull_request without secrets and upload the PR number as a short-lived artifact. New workflow_run leaf workflows pick that up and call reusable workflows that hold the token.

  • Labeler.yml now takes the PR number from the artifact, re-checks the PR state and head SHA through the API, and applies labels. Custom code replaces srvaroa/labeler, which does not support workflow_run. The code evaluates the same type/body rules from the regex config.
  • Labeler.yml also handles issues events directly, labeling issues when the config sets "issues: True".
  • PullRequestFormattingValidatorPost.yml is added to post comments for PR formatting issues. The title check itself still fails in the pull_request job (secret not needed for that).
  • The leaf workflows are updated to match the changes made to the files in their synced repos.

This was tested on my fork in makubacki/mu_basecore#109. An intentional failure due to the PR title to verify the comment could be posted successfully was made there.

The label and PR formatting leaf workflows used `pull_request_target`=
so they could use the GitHub App token.

They now trigger on `pull_request` without secrets and upload the PR
number as a short-lived artifact. New `workflow_run` leaf workflows
pick that up and call reusable workflows that hold the token.

- Labeler.yml now takes the PR number from the artifact, re-checks the
  PR state and head SHA through the API, and applies labels. Custom
  code replaces srvaroa/labeler, which does not support workflow_run.
  The code evaluates the same type/body rules from the regex config.
- Labeler.yml also handles issues events directly, labeling issues when
  the config sets "issues: True".
- PullRequestFormattingValidatorPost.yml is added to post comments
  for PR formatting issues. The title check itself still fails in the
  `pull_request` job (secret not needed for that).
- The leaf workflows are updated to match the changes made to the
  files in their synced repos.

Signed-off-by: Michael Kubacki <[email protected]>
@makubacki
Michael Kubacki (makubacki) merged commit 8949491 into microsoft:main Oct 28, 2026
5 checks passed
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.

3 participants