ci: add workflow that rejects merging jpeg and png images #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check File Names | |
on: | |
pull_request: | |
branches: [main] | |
jobs: | |
check-file-names: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history to ensure we can access all branches | |
- name: Fetch main branch | |
run: git fetch origin main | |
- name: List Added Files | |
id: list-files | |
run: | | |
# Get the list of added files from the pull request | |
git diff --name-only --diff-filter=A origin/main...HEAD > added-files.txt | |
- name: Check for Spaces in File Names | |
id: check-spaces | |
run: | | |
# Check for spaces in file names | |
if grep -q ' ' added-files.txt; then | |
echo "Error: Some added files have spaces in their names. Replace the spaces, for example, with a dash." | |
grep ' ' added-files.txt | |
exit 1 | |
else | |
echo "All added files have valid names." | |
fi |