Skip to content

YAML anchors for all verbose conditions, and precise label triggering conditions#7535

Merged
achamayou merged 6 commits intomicrosoft:mainfrom
eddyashton:yaml_label_trigger_sanitisation
Dec 17, 2025
Merged

YAML anchors for all verbose conditions, and precise label triggering conditions#7535
achamayou merged 6 commits intomicrosoft:mainfrom
eddyashton:yaml_label_trigger_sanitisation

Conversation

@eddyashton
Copy link
Copy Markdown
Member

First commit should be uncontroversial - applying the same tidy discussed in #7529 to long-verification.yml and bench-ab.yml.

Second is trying to rewrite these conditions to be more accurately triggered. Previously if you opened a PR that was already labeled, you'd get 2 separate events and 2 separate runs. and similarly if you labeled something (with any-old-junk) that also had the triggering label, we'd trigger another run. I think the correct condition is as spelt: labeled event only triggers this workflow when the relevant label is added, and the other pull_request action types only trigger this workflow if the label was present.

(NB: unlabeled is a separate event, so don't worry about triggers for removals).

This condition is now even longer and more unreadable. I think this multi-line block is valid YAML, but the GH Actions VS Code extension's language server isn't happy with it, so maybe they have a more restricted parser. Let's see what it looks like in the wild - I can flatten to one line again if necessary.

@eddyashton eddyashton requested a review from a team as a code owner December 16, 2025 14:00
Copilot AI review requested due to automatic review settings December 16, 2025 14:00
@eddyashton eddyashton added run-long-test Run Long Test job azure-linux and removed azure-linux labels Dec 16, 2025
@eddyashton eddyashton added run-long-test Run Long Test job azure-linux and removed run-long-test Run Long Test job azure-linux labels Dec 16, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors GitHub Actions workflow trigger conditions to use YAML anchors for code reusability and introduces more precise label-based triggering logic. The changes aim to prevent duplicate workflow runs when a PR is both labeled and opened/reopened simultaneously.

  • Introduces YAML anchors (&check_trigger_conditions) to deduplicate verbose trigger conditions across multiple jobs
  • Attempts to implement more precise label-triggering logic to distinguish between labeled events and other pull request events
  • Updates three workflow files with the new trigger condition pattern

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
.github/workflows/long-verification.yml Replaces inline trigger conditions with YAML anchor and anchor references across three jobs
.github/workflows/long-test.yml Updates the existing YAML anchor with new precise triggering logic
.github/workflows/bencher-ab.yml Replaces inline trigger conditions with YAML anchor and anchor references across three jobs

Comment thread .github/workflows/bencher-ab.yml Outdated
Comment thread .github/workflows/long-verification.yml Outdated
Comment thread .github/workflows/long-verification.yml Outdated
Comment thread .github/workflows/long-test.yml Outdated
Comment thread .github/workflows/long-test.yml Outdated
Comment thread .github/workflows/bencher-ab.yml Outdated
Comment thread .github/workflows/bencher-ab.yml Outdated
@achamayou achamayou enabled auto-merge (squash) December 16, 2025 17:09
@achamayou achamayou merged commit ef1261d into microsoft:main Dec 17, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-long-test Run Long Test job

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants