docs: clarify what the template creates #15
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: Build | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
bicep-build: | |
name: Bicep Build | |
runs-on: ubuntu-latest | |
env: | |
BICEP_FILE_PATH: main.bicep | |
OUTPUT_FILE_PATH: azuredeploy.json | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
with: | |
ref: ${{ github.head_ref }} # Required to push commit to PR | |
- name: Build Bicep file | |
id: build | |
shell: bash {0} # Required to check exit code | |
run: | | |
az bicep build --file "$BICEP_FILE_PATH" --outfile "$OUTPUT_FILE_PATH" | |
exit_code="$?" | |
if [[ "$exit_code" != 0 ]]; then | |
exit "$exit_code" | |
fi | |
git diff --exit-code "$OUTPUT_FILE_PATH" | |
exit_code="$?" | |
echo "exit-code=$exit_code" >> "$GITHUB_OUTPUT" | |
- name: Push commit | |
if: steps.build.outputs.exit-code != 0 | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add "$OUTPUT_FILE_PATH" | |
git commit -m "Build Bicep file" | |
git push |