Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add workflow validation to fix windows colon errors #520

Merged
merged 4 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/check-filenames-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Check Filenames on PR and Commits

on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- '**'

jobs:
check-filenames:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
fetch-depth: 0

- name: Check for invalid filenames
run: |
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"
exit 1
fi
Loading