Skip to content

Commit

Permalink
🌱 Use git diff instead of external action for changed files (ossf#3894)
Browse files Browse the repository at this point in the history
* Use git diff instead of third party action.

Signed-off-by: Spencer Schrock <[email protected]>

* clarify approach

Signed-off-by: Spencer Schrock <[email protected]>

---------

Signed-off-by: Spencer Schrock <[email protected]>
  • Loading branch information
spencerschrock authored and fhoeborn committed Apr 1, 2024
1 parent 9370c5d commit 25f9653
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,17 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
fetch-depth: 2 # needed to diff changed files
- id: files
name: Get changed files
uses: tj-actions/changed-files@90a06d6ba9543371ab4df8eeca0be07ca6054959 #v42.0.2
with:
files_ignore: '**.md'
- id: docs_only_check
if: steps.files.outputs.any_changed != 'true'
name: Check for docs-only changes
run: echo "docs_only=true" >> $GITHUB_OUTPUT
run: |
set +e # dont fail based on grep exit code
git diff --name-only HEAD~1 | grep --ignore-case --invert-match '.md$'
if [ $? -eq 1 ]; then
# no grep match (all files end in .md) produces exit code 1
echo "docs_only=true" >> $GITHUB_OUTPUT
else
echo "docs_only=false" >> $GITHUB_OUTPUT
fi
docker_matrix:
strategy:
Expand Down

0 comments on commit 25f9653

Please sign in to comment.