Skip to content

Commit

Permalink
Dynamically list all .latest branches for scheduled testing (#6682)
Browse files Browse the repository at this point in the history
* first pass at automating latest branches

* checkout repo first

* fetch all history

* reorg

* debugging

* update test id

* swap lines

* incorporate new branch aciton

* tweak vars
  • Loading branch information
emmyoop authored Feb 8, 2023
1 parent ccb4fa2 commit df64511
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion .github/workflows/release-branch-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,33 @@ on:
permissions: read-all

jobs:
fetch-latest-branches:
runs-on: ubuntu-latest

outputs:
latest-branches: ${{ steps.get-latest-branches.outputs.repo-branches }}

steps:
- name: "Fetch dbt-core Latest Branches"
uses: dbt-labs/actions/[email protected]
id: get-latest-branches
with:
repo_name: ${{ github.event.repository.name }}
organization: "dbt-labs"
pat: ${{ secrets.GITHUB_TOKEN }}
fetch_protected_branches_only: true
regex: "^1.[0-9]+.latest$"
perform_match_method: "match"
retries: 3

- name: "[ANNOTATION] ${{ github.event.repository.name }} - branches to test"
run: |
title="${{ github.event.repository.name }} - branches to test"
message="The workflow will run tests for the following branches of the ${{ github.event.repository.name }} repo: ${{ steps.get-latest-branches.outputs.repo-branches }}"
echo "::notice $title::$message"
kick-off-ci:
needs: [fetch-latest-branches]
name: Kick-off CI
runs-on: ubuntu-latest

Expand All @@ -39,7 +65,9 @@ jobs:
max-parallel: 1
fail-fast: false
matrix:
branch: [1.0.latest, 1.1.latest, 1.2.latest, 1.3.latest, 1.4.latest, main]
branch: ${{ fromJSON(needs.fetch-latest-branches.outputs.latest-branches) }}
include:
- branch: 'main'

steps:
- name: Call CI workflow for ${{ matrix.branch }} branch
Expand Down

0 comments on commit df64511

Please sign in to comment.