Skip to content

Commit

Permalink
Use elif instead of nested if
Browse files Browse the repository at this point in the history
  • Loading branch information
jak119 committed Mar 18, 2023
1 parent 5414598 commit 2d13552
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions .github/workflows/builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,17 @@ jobs:
- name: Check if add-on should be built
id: check
run: |
if [[ "${{ steps.info.outputs.image }}" != "null" ]]; then
if [[ "${{ steps.info.outputs.architectures }}" =~ ${{ matrix.arch }} ]]; then
echo "build_arch=true" >> $GITHUB_OUTPUT;
echo "image=$(echo ${{ steps.info.outputs.image }} | cut -d'/' -f3)" >> $GITHUB_OUTPUT;
if [[ -z "${{ github.head_ref }}" ]] && [[ "${{ github.event_name }}" == "push" ]]; then
echo "BUILD_ARGS=" >> $GITHUB_ENV;
fi
else
echo "${{ matrix.arch }} is not a valid arch for ${{ matrix.addon }}, skipping build";
echo "build_arch=false" >> $GITHUB_OUTPUT;
fi
if [[ "${{ steps.info.outputs.image }}" == "null" ]]; then
echo "Image property is not defined, skipping build"
echo "build_arch=false" >> $GITHUB_OUTPUT;
elif [[ "${{ steps.info.outputs.architectures }}" =~ ${{ matrix.arch }} ]]; then
echo "build_arch=true" >> $GITHUB_OUTPUT;
echo "image=$(echo ${{ steps.info.outputs.image }} | cut -d'/' -f3)" >> $GITHUB_OUTPUT;
if [[ -z "${{ github.head_ref }}" ]] && [[ "${{ github.event_name }}" == "push" ]]; then
echo "BUILD_ARGS=" >> $GITHUB_ENV;
fi
else
echo "Image property is not defined, skipping build"
echo "${{ matrix.arch }} is not a valid arch for ${{ matrix.addon }}, skipping build";
echo "build_arch=false" >> $GITHUB_OUTPUT;
fi
Expand Down

0 comments on commit 2d13552

Please sign in to comment.