2024-01-21 05:54:00 +00:00
|
|
|
name: Matrix Example
|
2022-12-30 07:03:31 +00:00
|
|
|
|
2024-01-13 07:31:45 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2022-12-30 07:03:31 +00:00
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
changed-files:
|
2023-11-20 03:05:34 +00:00
|
|
|
name: Get changed files
|
2022-12-30 07:03:31 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
2023-11-20 03:05:34 +00:00
|
|
|
matrix: ${{ steps.changed-files.outputs.all_changed_files }}
|
2022-12-30 07:03:31 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-10-03 00:09:57 +00:00
|
|
|
uses: actions/checkout@v4
|
2022-12-30 07:03:31 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: Get changed files
|
|
|
|
id: changed-files
|
|
|
|
uses: ./
|
|
|
|
with:
|
2024-03-09 01:20:45 +00:00
|
|
|
matrix: true
|
2022-12-30 07:03:31 +00:00
|
|
|
- name: List all changed files
|
|
|
|
run: echo '${{ steps.changed-files.outputs.all_changed_files }}'
|
|
|
|
|
|
|
|
matrix-job:
|
|
|
|
name: Run Matrix Job
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [changed-files]
|
|
|
|
strategy:
|
2023-11-20 03:05:34 +00:00
|
|
|
matrix:
|
|
|
|
files: ${{ fromJSON(needs.changed-files.outputs.matrix) }}
|
2022-12-30 07:03:31 +00:00
|
|
|
max-parallel: 4
|
|
|
|
fail-fast: false
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-10-03 00:09:57 +00:00
|
|
|
uses: actions/checkout@v4
|
2022-12-30 07:03:31 +00:00
|
|
|
- name: Test
|
|
|
|
run: |
|
2023-06-22 05:49:05 +00:00
|
|
|
echo ${{ matrix.files }}
|