Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.
This repository was archived by the owner on Feb 8, 2024. It is now read-only.

Question: Filtering scheduled pipelines by branch name #103

Open
@blag

Description

@blag

Hello, I'm digging through the new scheduled pipelines feature documentation.

When converting from the old scheduled workflows syntax, I noticed that there doesn't seem to be an equivalent way to ensure that scheduled pipelines only trigger for specific branches.

Old trigger:

daily-run-workflow:
  triggers:
    - schedule:
        # Every day, 0421Z.
        cron: "21 4 * * *"
        filters:
          branches:
            only:
              - main  # <-- Only run on the main branch
  jobs:
    - test
    - build

But there doesn't seem to be an equivalent way to filter workflows by branch name:

daily-run-workflow:
  when:
    and:
      - equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
      - equal: [ "my schedule name", << pipeline.schedule.name >> ]
      # Missing mechanism to filter by branch name
  jobs:
    - test
    - build

I hope I'm not misunderstanding how scheduled pipelines work with respect to branches, but please correct me if that's the case.

Is there an existing way to filter on branch name? Maybe something like:

daily-run-workflow:
  when:
    and:
      - equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
      - equal: [ "my schedule name", << pipeline.schedule.name >> ]
      - equal: [ "main", << pipeline.branch.name >> ]  # <-- only match when pipeline.branch.name equals "main"

Or is this on the development roadmap?

Scheduled pipelines look like a very cool feature, I'm looking forward to fully utilizing them! Thank you!

Edit: Fixed YAML syntax and reworded a bit for clarity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions