-
Notifications
You must be signed in to change notification settings - Fork 174
plugins: add new plugin for linking and unlinking issues to a PR #556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for k8s-prow ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Amulyam24 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
2dc443d to
30cf25e
Compare
| @@ -0,0 +1,95 @@ | |||
| /* | |||
| Copyright 2025 The Kubernetes Authors. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just FYI, current guidance is to not include the year for these copyright headers. I don't think it matters, just pointing it out to help spread awareness.
| unlinkIssueRegex = regexp.MustCompile(`(?mi)^/unlink-issue((?: +(?:\d+|[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+#\d+))+)\b`) | ||
| ) | ||
|
|
||
| type githubClient interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe there is a reason for defining this interface unless you are going to mock it for unit testing. Is that planned as a follow up? Might be good to have that included in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was planning that as a follow up. Sure, I'll add it to this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @stmcginnis, I explored a couple of ways on adding the UT.
At the end I feel having this interface and using the existing fake client is convenient than mocking the githubClient or using the plugins.PluginGitHubClient directly instead of githubClient as that would need mocking as well.
PTAL and let me know your thoughts!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a small local interface is somewhat established pattern in GH-facing plugins (retitle, blunderbuss), the GH client interface surface is massive and it is often useful to have an idea of what GH operations the plugin is limited to (besides the mentioned test mock use case). I'd prefer to keep it.
|
@Amulyam24: The label(s) `/label do-not-merge/work-in-progress
DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/hold WIP: Adding UT |
30cf25e to
427609d
Compare
afde1e0 to
c65a580
Compare
|
/unhold |
| unlinkIssueRegex = regexp.MustCompile(`(?mi)^/unlink-issue((?: +(?:\d+|[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+#\d+))+)\b`) | ||
| ) | ||
|
|
||
| type githubClient interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a small local interface is somewhat established pattern in GH-facing plugins (retitle, blunderbuss), the GH client interface surface is massive and it is often useful to have an idea of what GH operations the plugin is limited to (besides the mentioned test mock use case). I'd prefer to keep it.
|
I think this is pretty close, I appreciate the test coverage. Left some comment about the code structure. |
c65a580 to
0e49e0a
Compare
|
Hi @petr-muller, was out for year end vacation. Most of the review comments are in place, will be working on enhancing the logic as mentioned above and push the changes this week, Thanks! |
0e49e0a to
a49a972
Compare
c48a333 to
0625b0d
Compare
|
hi @petr-muller, I have updated the logic to handle both link and unlink and tested possible scenarios. UT has been added accordingly. The PR is ready for review, PTAL, Thanks! |
0625b0d to
ee09a0d
Compare
|
/retest |
This PR adds a new plugin issue-management which has commands for linking and unlinking issues to a PR. - The commands can be used to link an issue to a PR in the current repository or in a different repository as well as handle multiple issues - This is done by adding the supported keyword Fixes to the body of the PR if it doesn't already exist or by appending the issue to the existing Fixes line - Supported formats are issue-number and org/repo-name#issue-number Signed-off-by: Amulyam24 <amulmek1@in.ibm.com>
ee09a0d to
216670b
Compare
This PR adds a new plugin issue-management which has commands for linking and unlinking issues to a PR.
Ref - https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue
Fixesto the body of the PR if it doesn't already exist or by appending the issue to the existing Fixes lineissue-numberandorg/repo-name#issue-numberA new plugin has been added to accommodate any existing issue commands or provide flexibility to support more issue commands in the future.
Fixes #359