Skip to content

[gitlab] Improve issue_comment event handling - #391

Open
sondrebr wants to merge 6 commits into
EESSI:gitlabfrom
sondrebr:add-gitlab-support-improve-issue-comment-handling
Open

[gitlab] Improve issue_comment event handling#391
sondrebr wants to merge 6 commits into
EESSI:gitlabfrom
sondrebr:add-gitlab-support-improve-issue-comment-handling

Conversation

@sondrebr

@sondrebr sondrebr commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

This PR focuses on improving the handling of issue_comment events:

  • Added is_pr_comment as an EventInfo property. Returns true if the event is a PR comment, false otherwise (issue comment, pull request event etc.)
  • Updated the pr_* properties of EventInfo to enable them to be used when handling issue_comment events
    • is_pr_comment is used to check if it is a PR comment event and, if so, return the appropriate value
    • Added defaults in case the properties are accessed outside of PR or PR comment events
  • Added an is_pr_comment check to the start of handle_issue_comment_event() to make it return early if the comment is not a PR comment
  • Removed the issue_* properties from EventInfo (pr_* properties should be used instead)

The event handler hasn't handled issue comments properly, usually failing when attempting to use the pull/merge request API to interact with the issue. The is_pr_comment check makes it exit gracefully instead. Also, since we're now explicitly handling only PR comments, we can get rid of the issue_* properties and avoid confusion regarding when to use those vs. the pr_* properties.

The `pr_*` properties should be used instead from now on.
Both `PullRequest.merged` and `PullRequest.is_merged()` return the
same value, so both should be implemented in `MockPullRequest`
to prevent false test fails.
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.

1 participant