OpenAstronomy / OpenAstronomy/github-actions-workflows

Document how to schedule a workflow to run on specific branches

Open
#108 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
21
Forks
27
Avg merge
2d 9h
Merged PRs (30d)
1

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the reusable .github/workflows/tox.yml@v1 workflow and the actions/checkout@v3 configuration described in the issue. Check how GitHub Actions cron triggers and reusable workflow inputs interact with branch selection. Done means documenting or supporting cron-branches so scheduled runs cover each listed branch and environment, while other triggers retain the default branch behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions
Domain
ci-cd
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.