Skip to content

Commit

Permalink
fix: use checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
GangGreenTemperTatum committed Dec 27, 2024
1 parent 158b821 commit a3e099d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/check-filenames-pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Check Filenames on PR
name: Check Filenames on PR and Commits

on:
pull_request:
Expand All @@ -12,13 +12,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
fetch-depth: 0

- name: Check for invalid filenames
run: |
invalid_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep ":" || true)
if [ "${{ github.event_name }}" = "pull_request" ]; then
invalid_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep ":" || true)
else
invalid_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep ":" || true)
if [ -z "$invalid_files" ]; then
# Also check all files in the current commit
invalid_files=$(git ls-files | grep ":" || true)
fi
fi
if [ ! -z "$invalid_files" ]; then
echo "Error: The following files contain ':' in their names, which is not compatible with Windows:"
echo "$invalid_files"
Expand Down

0 comments on commit a3e099d

Please sign in to comment.