Skip to content

feat: Ignore PRs with Certain Patterns (SRV-216)#129

Closed
vsaltxx wants to merge 1 commit into
espressif:v1from
vsaltxx:feat/ignore-prs-by-pattern
Closed

feat: Ignore PRs with Certain Patterns (SRV-216)#129
vsaltxx wants to merge 1 commit into
espressif:v1from
vsaltxx:feat/ignore-prs-by-pattern

Conversation

@vsaltxx
Copy link
Copy Markdown
Contributor

@vsaltxx vsaltxx commented Apr 17, 2026

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

  • added new module sync_jira_actions/ignore_pr.py
  • introduced default ignored title prefixes:
    • build(deps):
    • build(deps-dev):
    • [pre-commit.ci]
  • introduced default ignored authors:
    • dependabot[bot]
    • pre-commit-ci[bot]
  • added helper functions for parsing configured prefixes/authors
  • added should_ignore_pr(title, author_login) returning (bool, reason)
  • added action inputs:
    • ignore-title-prefixes
    • ignore-authors
  • documented usage in README

Related

SRV-117: Ignore PRs with Certain Patterns

Testing

Added unit tests for ignoring logic.

@github-actions github-actions Bot changed the title feat: Ignore PRs with Certain Patterns feat: Ignore PRs with Certain Patterns (SRV-216) Apr 17, 2026
@vsaltxx vsaltxx marked this pull request as ready for review April 17, 2026 14:00
@vsaltxx vsaltxx requested a review from a team as a code owner April 17, 2026 14:00
@vsaltxx vsaltxx requested review from XDanielPaul and Copilot and removed request for a team April 17, 2026 14:00
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py with default ignore lists + env-configurable extensions and should_ignore_pr(...).
  • Applies ignore logic in both sync_to_jira.py (webhook-driven) and sync_pr.py (cron sweep), including skip messaging.
  • Adds unit tests and documents new action inputs + defaults in action.yml and README.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
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback


from github import Github
from github import GithubException
from ignore_pr import should_ignore_pr
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread tests/test_ignore_pr.py
Comment on lines +8 to +14
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
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread README.md
Comment on lines +103 to +107
| 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). |

Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

@vsaltxx vsaltxx marked this pull request as draft April 17, 2026 14:28
@vsaltxx vsaltxx requested a review from Copilot April 17, 2026 14:29
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +21 to 23
from ignore_pr import should_ignore_pr
from sync_issue import _create_jira_issue
from sync_issue import _find_jira_issue
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown

This PR is stale because it has been open 30 days with no activity. Remove Status: Stale label or comment or this will be closed in 7 days.

@github-actions
Copy link
Copy Markdown

This PR was closed because it has been stalled for 10 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants