Skip to content

Commit

Permalink
Skip second action if count is 0 (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjreed121 authored Nov 14, 2023
1 parent 5a8a99e commit 73a4045
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
run_docker_jobs: ${{ steps.set-run-docker-jobs.outputs.run_docker_jobs }}
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -22,9 +23,18 @@ jobs:
- name: List Matrix
run: |
echo ${{ steps.set-matrix.outputs.matrix }}
- name: Set Run Condition
run: |
num_to_build=$(echo ${{ steps.set-matrix.outputs.matrix }} | jq '.include | length')
if [[ "$num_to_build" -eq 0 ]]; then
echo "run_docker_jobs=false" >> $GITHUB_OUTPUT
else
echo "run_docker_jobs=true" >> $GITHUB_OUTPUT
fi
docker:
needs:
- generate-matrix
if: needs.generate-matrix.outputs.run_docker_jobs == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: true
Expand Down

0 comments on commit 73a4045

Please sign in to comment.