Skip to content

Document how to schedule a workflow to run on specific branches #108

@WilliamJamieson

Description

@WilliamJamieson

I would like to be able to pass a specific branch to an OpenAstronomy workflow, so that I can use them to run a cron job against my release branches. Normally, to schedule a cron job on the non default branch one needs to specify:

- uses: actions/checkout@v3
  with:
    ref: non-default-branch

in the checkout phase.

Ideally, I would like to able to say, specify say cron-branches: to the tox workflow. When the workflow is triggered by a the cron it launch the workflow on each of the cron-branches rather than on the default branch for the workflow. That is if

jobs:
  test:
    uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
    with:
      posargs: '-n 4'
      cron-branches:
        - main
        - release
      envs: |
        - linux: pep8
          pytest: false
        - macos: py310
        - windows: py39-docs
          libraries:
            choco:
              - graphviz

This workflow would launch 6 actions, one action for each env on each of the branches. Then if not triggered by cron it would just run on the normal default branch.

Doing this would let me schedule my CI to run on my main and release branches so the CI gets run even if no PRs get opened or merged in a given time period.

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