Skip to content

feat: add bicep file linting #13

feat: add bicep file linting

feat: add bicep file linting #13

Workflow file for this run

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;