Skip to content

Commit

Permalink
update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcg0 committed Dec 3, 2023
1 parent 85065bf commit bc773b9
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/dockerfile-test-v1.0.1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,21 @@ jobs:
with:
# Checkout as many commits as needed for the diff
fetch-depth: 2
- shell: pwsh

- shell: bash
id: check_file_changed
run: |
# Diff HEAD with the previous commit
$diff = git diff --name-only HEAD^ HEAD
diff=$(git diff --name-only HEAD^ HEAD)
# check if the Dockerfile has changed (added, modified, deleted) at /docker/$DOCKERFILE_NAME
$DockerfileDiff = $diff | Where-Object { $_ -match '^docker/$env:DOCKERFILE_NAME' }
$HasDiff = $DockerfileDiff.Length -gt 0
DockerfileDiff=$(echo "$diff" | grep -E "^docker/$DOCKERFILE_NAME")
HasDiff=$(echo "$DockerfileDiff" | wc -l)
# echo the output to $GITHUB_OUTPUT
echo "file_changed=$HasDiff" >> $GITHUB_ENV
# Set the output named "file_changed"
Write-Host "::set-output name=file_changed::$HasDiff"
- name: print file_changed
- name: print if file changed
run: echo "file_changed=${{ steps.check_file_changed.outputs.file_changed }}"

test:
Expand Down

0 comments on commit bc773b9

Please sign in to comment.