Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion .github/workflows/scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,51 @@ permissions:
actions: write

jobs:
# Figure out which branches to run CI on. This is the main branch, plus the
# three most recent release-X.Y branches (as per the support policy in
# RELEASES.md, we maintain latest, latest-1, and latest-2).
#
# Note this is based on branch existence rather than released versions, so
# from the moment a new release branch is created (at rc1, i.e. about two
# months before the .0 release) until that release is out, the oldest
# supported branch (latest-2) is not covered here. This is deliberate:
# testing the upcoming release is more valuable, and the branch in question
# is still tested on every PR and via workflow_dispatch.
prepare:
runs-on: ubuntu-latest
outputs:
branches: ${{ steps.branches.outputs.result }}
steps:
- name: Find branches to test
id: branches
uses: actions/github-script@v9
with:
result-encoding: string
script: |
const re = /^release-(\d+)\.(\d+)$/;
const all = await github.paginate(github.rest.repos.listBranches, {
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 100,
});
const rel = all
.map((b) => b.name.match(re))
.filter((m) => m !== null)
.sort((a, b) => b[1] - a[1] || b[2] - a[2])
.slice(0, 3)
.map((m) => m[0]);
if (rel.length === 0) {
core.setFailed('No release-X.Y branches found.');
}
const branches = ['main', ...rel];
core.info(`Branches to test: ${branches.join(' ')}`);
return JSON.stringify(branches);

trigger-workflow:
needs: prepare
strategy:
matrix:
branch: ["main", "release-1.5", "release-1.4", "release-1.3"]
branch: ${{ fromJSON(needs.prepare.outputs.branches) }}
wf_id: ["validate.yml", "test.yml"]
runs-on: ubuntu-latest
steps:
Expand Down
Loading