Update README.md #1093
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: matrix-from-previous-job-output-2 | |
on: | |
pull_request: | |
jobs: | |
setup: | |
outputs: | |
DEV_CHANGED: ${{ steps.changed-files-yaml.outputs.dev_any_changed }} | |
PROD_CHANGED: ${{ steps.changed-files-yaml.outputs.prod_any_changed }} | |
CHANGED_ENVS: ${{ steps.matrix.outputs.CHANGED_ENVS }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
with: | |
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. | |
- name: get all changes for static/dev and static/prod | |
id: changed-files-yaml | |
uses: tj-actions/changed-files@v45 | |
with: | |
files_yaml: | | |
dev: | |
- 'static/dev/**' | |
prod: | |
- 'static/prod/**' | |
- id: matrix | |
run: | | |
echo "dev: ${{ steps.changed-files-yaml.outputs.dev_any_changed }}" >> "$GITHUB_STEP_SUMMARY" | |
echo "prod: ${{ steps.changed-files-yaml.outputs.prod_any_changed }}" >> "$GITHUB_STEP_SUMMARY" | |
echo "CHANGED_ENVS=$(echo "[{\"env\": \"dev\", \"changed\": ${{ steps.changed-files-yaml.outputs.dev_any_changed }}}, {\"env\":\"prod\", \"changed\": ${{ steps.changed-files-yaml.outputs.prod_any_changed }} }]" | jq -c 'map(select( .changed ).env)')" >> "$GITHUB_OUTPUT" | |
execute: | |
if: needs.setup.outputs.CHANGED_ENVS != '[]' | |
strategy: | |
matrix: | |
env: ${{ fromJson(needs.setup.outputs.CHANGED_ENVS) }} | |
runs-on: ubuntu-latest | |
needs: [setup] | |
# if: ${{ matrix.env == 'dev' }} ❌ matrix value can be used only in steps | |
steps: | |
- run: | | |
echo "matrix: ${{ matrix.env }}" |