-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
DEV: CI checks for gitignored files (#81)
1 parent
0aa70e2
commit 00356c0
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Check for Gitignored Files | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' # Run on all branches | ||
pull_request: | ||
|
||
jobs: | ||
check-gitignored-files: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Check for gitignored files in commit | ||
run: | | ||
# List all files in the commit | ||
git diff --name-only --cached > committed_files.txt | ||
# Check if any of the committed files are ignored by .gitignore | ||
git check-ignore -v $(cat committed_files.txt) > ignored_files.txt || true | ||
# Fail if there are any ignored files | ||
if [[ -s ignored_files.txt ]]; then | ||
echo "The following files are gitignored but committed:" | ||
cat ignored_files.txt | ||
exit 1 | ||
fi |