Skip to content

Instantly share code, notes, and snippets.

@cdhunt
Created September 23, 2021 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdhunt/1f63b97f1fc3fde3b481d12008eb8ae3 to your computer and use it in GitHub Desktop.
Save cdhunt/1f63b97f1fc3fde3b481d12008eb8ae3 to your computer and use it in GitHub Desktop.
Dymanic-ish GitHub Actions Workflow
jobs:
setup:
name: Setup Workflow Variables
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Generate Build matrix
id: matrix
shell: pwsh
run: |
$matrix = @{include = @()}
# Possible loop
$item = @{
Repo = "blah"
PAT = "${{ secrets.PAT }}"
}
$matrix['include'] += $item
# End Loop
Write-Host ("::set-output name=matrix::{0}" -f ($matrix | ConvertTo-Json -Compress))
checkout:
name: Build Stack Overflow image (${{ matrix.Repo }}
runs-on: ubuntu-latest
needs: [setup]
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.setup.outputs.matrix) }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
repository: ${{ matrix.Repo }}
token: ${{ matrix.PAT }}
path: './somepath/${{ matrix.Repo }}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment