From a50ca43327bba413532843aa5a0e300632440f22 Mon Sep 17 00:00:00 2001 From: Henrik Simonsen Knutsen <46495473+hknutsen@users.noreply.github.com> Date: Thu, 2 Jan 2025 12:27:10 +0100 Subject: [PATCH] ci: compare Bicep file in PR to Bicep file in base branch (#20) Resolves issue where Bicep file is not built even though changes have been made. --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ed5fb4c..1dde4b0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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."