Skip to content

ci: add PR sanity check workflow#794

Merged
SchoolyB merged 3 commits intomainfrom
ci/add-pr-sanity-check
Dec 23, 2025
Merged

ci: add PR sanity check workflow#794
SchoolyB merged 3 commits intomainfrom
ci/add-pr-sanity-check

Conversation

@SchoolyB
Copy link
Copy Markdown
Owner

Summary

Adds a GitHub Actions workflow that automatically rejects PRs containing:

  • Binary/executable files (except images)
  • Meta/config files from other language ecosystems (package.json, requirements.txt, Cargo.toml, etc.)

Based on @prjctimg's work in #793, with fixes applied to make the workflow functional.

Changes from #793

  • Added permissions block for pull-requests: write
  • Added fetch-depth: 0 for full git history access
  • Added step to fetch base branch before running diff
  • Changed hardcoded origin/main to origin/${{ github.base_ref }}
  • Fixed multiline grep pattern that wasn't working
  • Fixed MIME type extraction (was extracting file path instead of type)
  • Fixed SVG mime type (svg+xml)
  • Added GH_TOKEN env variable for gh pr close
  • Added ::error:: annotations for GitHub Actions UI

Closes #793

prjctimg and others added 3 commits December 23, 2025 01:53
This workflow will close PRs that have binary (executables) and archive
files. It also rejects the PR if the changes include meta files specific
to other programming language ecosystems.

It will accept image graphic files (which are treated as binary) though.
Improves upon @prjctimg's work in #793.

- Add permissions block for pull-requests: write
- Add fetch-depth: 0 for full git history
- Add step to fetch base branch before diff
- Use github.base_ref instead of hardcoded origin/main
- Fix multiline grep pattern (single line now)
- Fix MIME type extraction using file --mime-type -b
- Fix SVG mime type to svg+xml
- Add GH_TOKEN env for gh pr close command
- Use ::error:: annotations for better GitHub UI integration
Block by extension:
- .exe, .dll (Windows binaries)
- .out (Go coverage)
- .ezdb, .db, .sqlite, .sqlite3 (databases)

Block folders:
- .idea/, .vs/ (IDE junk)
- __pycache__/ (Python)

Block OS junk:
- Thumbs.db, Desktop.ini, .DS_Store
@SchoolyB SchoolyB merged commit b046be2 into main Dec 23, 2025
6 checks passed
@SchoolyB SchoolyB deleted the ci/add-pr-sanity-check branch December 23, 2025 03:39
SchoolyB added a commit that referenced this pull request Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants