feat: Ignore PRs with Certain Patterns (SRV-216)#129
Conversation
There was a problem hiding this comment.
Pull request overview
Adds configurable PR ignore rules (by author and title prefix) so bot/noisy PRs are skipped during both event-driven sync and the cron sweep.
Changes:
- Introduces
sync_jira_actions/ignore_pr.pywith default ignore lists + env-configurable extensions andshould_ignore_pr(...). - Applies ignore logic in both
sync_to_jira.py(webhook-driven) andsync_pr.py(cron sweep), including skip messaging. - Adds unit tests and documents new action inputs + defaults in
action.ymlandREADME.md.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
sync_jira_actions/ignore_pr.py |
Implements parsing/defaults and the should_ignore_pr decision logic. |
sync_jira_actions/sync_to_jira.py |
Skips PR syncing early when ignore rules match. |
sync_jira_actions/sync_pr.py |
Skips cron-swept PRs when ignore rules match. |
action.yml |
Adds inputs and passes them via env vars to the Python entrypoint. |
README.md |
Documents default ignore patterns and how to extend them. |
tests/test_ignore_pr.py |
Adds focused unit tests for ignore logic. |
tests/test_sync_to_jira.py |
Adds integration-style tests ensuring ignored PRs don’t trigger handlers. |
tests/test_sync_pr.py |
Adds tests ensuring cron sweep skips ignored PRs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| from github import Github | ||
| from github import GithubException | ||
| from ignore_pr import should_ignore_pr |
There was a problem hiding this comment.
ignore_pr is being imported as a top-level module. Since this repository is also a Python package (sync_jira_actions/__init__.py exists) and tests import sync_jira_actions.sync_to_jira, this import will raise ModuleNotFoundError in a clean environment (because ignore_pr.py lives under sync_jira_actions/). Consider switching to package-qualified imports (e.g., importing from sync_jira_actions.ignore_pr) and updating the action entrypoint to run the module (e.g., python -m ...) so sibling imports continue to work reliably.
There was a problem hiding this comment.
@copilot apply changes based on this feedback
|
|
||
| from github import Github | ||
| from github import GithubException | ||
| from ignore_pr import should_ignore_pr |
There was a problem hiding this comment.
Same as sync_to_jira.py: importing ignore_pr as a top-level module is likely to fail when sync_jira_actions.sync_pr is imported as part of the sync_jira_actions package. Prefer a package-qualified import (and adjust the execution entrypoint accordingly) to avoid ModuleNotFoundError outside the “run script from inside the directory” scenario.
| def ignore_pr_module(monkeypatch): | ||
| """Reload the module for each test so env var reads are re-evaluated.""" | ||
| sys.path.insert(0, 'sync_jira_actions') | ||
| import ignore_pr | ||
|
|
||
| importlib.reload(ignore_pr) | ||
| return ignore_pr |
There was a problem hiding this comment.
This fixture mutates sys.path via sys.path.insert(...) and never restores it, which can leak state across tests and make the suite order-dependent. Prefer importing via the package (sync_jira_actions.ignore_pr) or use monkeypatch.syspath_prepend('sync_jira_actions') so pytest reliably cleans up after each test.
| | Input | Description | | ||
| | ----------------------- | --------------------------------------------------------------------------------------------------------- | | ||
| | `ignore-title-prefixes` | Comma-separated title prefixes (case-insensitive). A PR is ignored if its title starts with any of these. | | ||
| | `ignore-authors` | Comma-separated author logins (case-insensitive, exact match). | | ||
|
|
There was a problem hiding this comment.
The markdown table uses || at the start of each row, which doesn’t render as a standard GitHub-flavored markdown table. Use single | delimiters (one leading/trailing pipe per row) so the inputs table displays correctly in the README.
There was a problem hiding this comment.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| from ignore_pr import should_ignore_pr | ||
| from sync_issue import _create_jira_issue | ||
| from sync_issue import _find_jira_issue |
There was a problem hiding this comment.
Same issue as in sync_to_jira.py: from ignore_pr import should_ignore_pr will raise ModuleNotFoundError when importing sync_jira_actions.sync_pr as a package module. Use package-relative/package-qualified imports (and align the sync_issue imports too) so this module can be imported reliably in tests/when installed.
| from ignore_pr import should_ignore_pr | |
| from sync_issue import _create_jira_issue | |
| from sync_issue import _find_jira_issue | |
| from .ignore_pr import should_ignore_pr | |
| from .sync_issue import _create_jira_issue | |
| from .sync_issue import _find_jira_issue |
|
This PR is stale because it has been open 30 days with no activity. Remove |
|
This PR was closed because it has been stalled for 10 days with no activity. |
Description
Bot-generated PRs can feel noisy. This feature makes it possible to ignore pull requests by author and title prefix, using default patterns for Dependabot and pre-commit.ci.
Implemented changes
Related
SRV-117: Ignore PRs with Certain Patterns
Testing
Added unit tests for ignoring logic.