Skip to content

Update matrix-from-previous-job-output-3.yml #33

Update matrix-from-previous-job-output-3.yml

Update matrix-from-previous-job-output-3.yml #33

name: matrix-from-previous-job-output-3
on:
pull_request:
push

Check failure on line 4 in .github/workflows/matrix-from-previous-job-output-3.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/matrix-from-previous-job-output-3.yml

Invalid workflow file

You have an error in your yaml syntax on line 4
jobs:
# From https://github.com/dorny/paths-filter
# JOB to run change detection
set-matrix:
runs-on: ubuntu-latest
outputs:
include: ${{ steps.set-matrix.outputs.include }}
steps:
- uses: actions/checkout@v4
- name: set matrix
id: set-matrix
run: |
if [[ "${{ github.event_name }}" = "pull_request" ]]; then
echo "include=[{\"app\": \"app1\", \"env\": \"dev\"}, {\"app\": \"app2\", \"env\": \"dev\"}]" >> "$GITHUB_OUTPUT"
elif [[ "${{ github.event_name }}" = "push" ]]; then
echo "include=[{\"app\": \"app1\", \"env\": \"dev\"}, {\"app\": \"app1\", \"env\": \"prod\"}, {\"app\": \"app2\", \"env\": \"dev\"}, {\"app\": \"app2\", \"env\": \"prod\"}]" >> "$GITHUB_OUTPUT"
fi
execute:
strategy:
matrix:
include: ${{ fromJson(needs.set-matrix.outputs.include) }}
runs-on: ubuntu-latest
needs: [set-matrix]
steps:
- name: "app: ${{ matrix.app }}, matrix: ${{ matrix.env }}"
run: |
echo "app: ${{ matrix.app }}, matrix: ${{ matrix.env }}"