Skip to content

Commit

Permalink
ci: compare Bicep file in PR to Bicep file in base branch (#20)
Browse files Browse the repository at this point in the history
Resolves issue where Bicep file is not built even though changes have been made.
  • Loading branch information
hknutsen authored Jan 2, 2025
1 parent 9dd6db6 commit a50ca43
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ jobs:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
ref: ${{ github.head_ref }} # Required to push commit to PR
fetch-depth: 0 # Required to show diff between PR source and target branch
ref: ${{ github.head_ref }} # Required to push commit to PR source branch

- name: Build Bicep file
id: build
shell: bash {0} # Required to check exit code
run: |
git diff --exit-code "$BICEP_FILE_PATH"
git diff --exit-code "origin/$GITHUB_BASE_REF" "$BICEP_FILE_PATH"
exit_code="$?"
if [[ "$exit_code" == 0 ]]; then
echo "No changes made to Bicep file. Skipping build."
Expand Down

0 comments on commit a50ca43

Please sign in to comment.