There are times when we have a PR open for a repository, that we're tracking via a GUS work item, but for which there isn't a corresponding GitHub issue.
From looking at Git2Gus source it seems that at the moment, the only way to have Git2Gus close the work item automatically when such a PR is merged, would be to:
file a (redundant) GitHub issue
manually link that issue with the GUS work item (using the @W-1234@ annotation)
and have the PR use a closes #NN style annotation
...which would close the GH issue on merge, and thus in turn the GUS work item.
To save having to create that redundant GitHub work item, it would be great if Git2Gus would listen to the GitHub PR close event, and if the PR description contained the @W-1234@ annotation, then directly close the associated work item.
Now I'm presuming perhaps there are times when one wouldn't want the work item to be closed (eg multiple PRs for a work item, and only the first has merged) - so this should likely only take effect if using say Closes @W-1234@ (or similar)?
To implement I'm presuming the existing integrateWorkItem action could be modified like so...
Hi!
There are times when we have a PR open for a repository, that we're tracking via a GUS work item, but for which there isn't a corresponding GitHub issue.
From looking at Git2Gus source it seems that at the moment, the only way to have Git2Gus close the work item automatically when such a PR is merged, would be to:
@W-1234@
annotation)closes #NN
style annotation...which would close the GH issue on merge, and thus in turn the GUS work item.
To save having to create that redundant GitHub work item, it would be great if Git2Gus would listen to the GitHub PR close event, and if the PR description contained the
@W-1234@
annotation, then directly close the associated work item.Now I'm presuming perhaps there are times when one wouldn't want the work item to be closed (eg multiple PRs for a work item, and only the first has merged) - so this should likely only take effect if using say
Closes @W-1234@
(or similar)?To implement I'm presuming the existing
integrateWorkItem
action could be modified like so...The
GithubEvents.events.PULL_REQUEST_CLOSED
event added here: https://github.com/forcedotcom/git2gus/blob/dbe8c53c7bf703d7607ca595ef0a473a843eb3b9/api/actions/integrateWorkItem.js#L19Then the calculation for the URL to use for related_url adjusted here to work with the PR URL too: https://github.com/forcedotcom/git2gus/blob/dbe8c53c7bf703d7607ca595ef0a473a843eb3b9/api/actions/integrateWorkItem.js#L21-L23
And finally, something like the
@W-1234@
annotation logic from here added (with the slight change of needing the "Closes " prefix or similar): https://github.com/forcedotcom/git2gus/blob/dbe8c53c7bf703d7607ca595ef0a473a843eb3b9/api/actions/createChangelist.js#L27-L34Does that sound reasonable? :-)