Skip to content

S-130550-epic-support-for-epic#12

Open
rohithamroser wants to merge 5 commits intomainfrom
S-130550-epic-support-for-epic
Open

S-130550-epic-support-for-epic#12
rohithamroser wants to merge 5 commits intomainfrom
S-130550-epic-support-for-epic

Conversation

@rohithamroser
Copy link
Copy Markdown
Collaborator

No description provided.

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

This PR extends the GitLab plugin to better support group-level Epics (work items) by normalizing API base URLs, adding group webhook support for “No Project” mappings, and improving inbound payload parsing for work_item/Epic events.

Changes:

  • Introduces get_api_url() and uses it to consistently target /api/v4 (including uploads/connector usage).
  • Adds group webhook support (groups/:id/hooks) and routes “no_project” webhook creation to group hooks.
  • Enhances inbound payload handling to derive project/group context for work_item/Epic events and improves event categorization/type handling.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

File Description
gitlab/transformer_functions.py Adds API base URL normalization and a new group webhooks helper.
gitlab/sync.py Updates upload URLs, improves payload-derived project/asset logic, and adjusts event parsing for work_item/Epic.
gitlab/mapping.py Creates webhooks at group scope for “No Project” (epic/group) mappings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

gitlab/sync.py Outdated
Comment on lines +30 to +32
def fetch_url(self):

return "{}/{}".format("'https://gitlab.com",self.private_data["url"])
return "{}/{}".format("https://gitlab.com", self.private_data["url"])
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

Attachment URLs are being built with a hard-coded "https://gitlab.com" base. This will break downloads for self-managed GitLab instances configured via instance_details["url"]. Consider deriving the base web URL from the configured instance URL (and joining with the relative upload path) instead of forcing gitlab.com.

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

Choose a reason for hiding this comment

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

this is a refactor will be handled on attachment defect item

Comment on lines 60 to +63
except Exception as e:
error_msg = 'Unable to sync comment. Error is [{}]. The comment is [{}]'.format(str(e), comment)
error_msg = 'Unable to sync comment. Error is [{}]. The comment is [{}]'.format(
str(e), payload.get("body", "")
)
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

In the exception handler, the error message references payload.get(...), but payload is defined inside the try block and may be unbound if an exception occurs before it is assigned (e.g., formatting errors / missing keys). Define the comment body (or payload) before the try, or guard against payload not existing, to avoid masking the original exception with an UnboundLocalError.

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

Choose a reason for hiding this comment

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

Checked and modified

gitlab/sync.py Outdated
event_type = self.event['object_attributes']["action"]
event_type = self.event['object_attributes'].get("action", "update")

if event_type in ('open'):
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

if event_type in ('open'): is treating ('open') as a string, so the membership check is against characters (e.g., 'p' would match). This can misclassify events. Use a direct string comparison (event_type == "open") or a real tuple (event_type in ("open",)).

Suggested change
if event_type in ('open'):
if event_type == "open":

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

Choose a reason for hiding this comment

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

checked and modified

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