A GitHub Action that manages required checks based on GitHub repository rulesets and file changes in pull requests. This action extracts required status checks from specified rulesets and automatically marks checks as successful when:
- Workflow path filters don't match any changed files
- The job doesn't exist in any workflow in the repository
- Ruleset Integration: Reads required status checks directly from GitHub repository rulesets
- Path Filtering: Automatically detects path filters from workflow configurations
- Conditional Check Enforcement: Marks checks as successful when no relevant files are changed
- Missing Job Handling: Automatically marks jobs as successful if they don't exist in any workflow
- Workflow Discovery: Automatically finds workflows containing specified job name
- Monorepo setups where different services have separate test suites
- Projects with multiple components that don't always need to run all checks
- Reducing CI costs by skipping irrelevant checks
- Managing required checks through GitHub rulesets
- Handling cases where required checks might not exist in all branches or configurations
- Create GitHub repository rulesets with required status checks
- Configure your workflows with appropriate path filters
- Set up this action to process the rulesets
name: PR Path Filter
on:
pull_request:
jobs:
filter-checks:
runs-on: ubuntu-latest
permissions:
statuses: write
pull-requests: read
contents: read
steps:
- uses: actions/checkout@v4
- name: Run Path-Based Checks
uses: temap/pr-checks@v2
with:
rulesets: |
main-branch-protection- Go to Settings → Rules → Rulesets in your GitHub repository
- Create a new ruleset (e.g., "main-branch-protection")
- Add "Require status checks to pass" rule
- Configure the required status checks (e.g., "frontend-tests", "backend-tests")
- The action fetches the specified rulesets from your repository
- It extracts all required status checks from these rulesets
- For each required check:
- If a workflow with that job name doesn't exist → marks as successful
- If the workflow exists but path filters don't match changed files → marks as successful
- Otherwise → lets the check run normally
| Name | Description | Required | Default |
|---|---|---|---|
rulesets |
List of ruleset names to process (one per line) | Yes | - |
github-token |
GitHub token for API access | No | ${{ github.token }} |
This action requires the following permissions:
permissions:
statuses: write # To create commit statuses
pull-requests: read # To read PR information
contents: read # To access repository content and rulesets