feat: add bicep file linting #13
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: Bicep | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
lint: | |
name: Linting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# - name: Setup Bicep | |
# run: | | |
# curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64 | |
# chmod +x ./bicep | |
# sudo mv ./bicep /usr/local/bin/bicep | |
- name: Lint Bicep | |
run: | | |
success="true" | |
FILES=$(find `pwd` \( -name "*.bicep" -o -name "*.bicepparam" \)) | |
echo "🔍 Files to lint:" | |
echo $FILES | |
for file in $FILES; do | |
{ # 'try' block | |
echo "🎗️ Linting $file" && az bicep lint --file $file | |
} || { # 'catch' block | |
success="false" | |
} | |
done | |
if [ "$success" = "false" ]; then | |
echo "::error::❌ Linting of the Bicep files failed." | |
exit 1; | |
fi; |