Skip to content

Conversation

@eddyashton
Copy link
Member

It's rubbish that we keep repeating these complex conditions in every label-triggered job, and worse that they're slightly inaccurate (run on any trigger if label is present, rather than this label was added and also other trigger and label is present).

Found a blog from yesterday saying that we don't have to do the first part anymore!

https://github.blog/news-insights/product-news/lets-talk-about-github-actions/#h-yaml-anchors-reduce-duplication-in-complex-workflows
https://docs.github.com/en/actions/reference/workflows-and-actions/reusing-workflow-configurations#yaml-anchors-and-aliases

The magic words here for future reference are "YAML anchors and aliases", and we could use them all over the place to deduplicate. For now I'm just experimenting with replacing the long-test label condition.

@eddyashton eddyashton requested a review from a team as a code owner December 12, 2025 16:04
Copilot AI review requested due to automatic review settings December 12, 2025 16:04
@eddyashton eddyashton added the run-long-test Run Long Test job label Dec 12, 2025
Copy link
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 modernizes the GitHub Actions workflow by leveraging YAML anchors and aliases to eliminate duplication of conditional logic across multiple jobs. The change takes advantage of GitHub Actions' newly announced support for YAML anchors, replacing five identical conditional expressions with a single anchor definition and alias references.

  • Defines a YAML anchor &check_trigger_conditions on the first job's condition
  • Replaces four duplicate conditional expressions with alias references *check_trigger_conditions

@achamayou achamayou merged commit 572ee59 into microsoft:main Dec 12, 2025
34 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.

4 participants