Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Test Github Actions Dynamic Matrix #3

Test Github Actions Dynamic Matrix

Test Github Actions Dynamic Matrix #3

Workflow file for this run

name: Test Github Actions Dynamic Matrix
on:
workflow_dispatch:
inputs:
count:
description: 'Number of matrix jobs'
required: true
default: '1'
type: number
jobs:
setup:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.value }}
steps:
- id: matrix
run: |
count=${{ github.event.inputs.count }}
# Generate matrix values based on the count
matrix_values=$(seq -f '"%g"' 1 "$count" | paste -sd, -)
echo "value=[${matrix_values}]" >> $GITHUB_ENV
- run: |
echo "Matrix values: ${{ env.value }}"
build:
needs: setup
runs-on: ubuntu-latest
strategy:
matrix:
value: ${{ fromJson(needs.setup.outputs.matrix) }}
max-parallel: 1 # Run one job at a time
steps:
- run: |
echo "Processing value: ${{ matrix.value }}"