Skip to content
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

Document how to unlink a work item from its GitHub issue #85

Open
edmorley opened this issue Aug 2, 2020 · 0 comments
Open

Document how to unlink a work item from its GitHub issue #85

edmorley opened this issue Aug 2, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@edmorley
Copy link
Member

edmorley commented Aug 2, 2020

On https://lwc-gus-bot.herokuapp.com there is a section that describes how to manually link a GitHub issue to an existing work item.

However:

  • there's no mention of how to unlink a work item (in case the link was added mistakenly, or no longer wanted)
  • trying to guess how to unlink the work item is hard, since the docs don't currently mention how Git2Gus tracks the links (which could be based on metadata, or Git2Gus could be stateful)

From reading the source it appears that Git2Gus uses the work item related_url__c field to store state, and that unlinking differs depending on whether the work item was automatically created or not.

For manually linked work items, it seems that they can be unlinked by simply removing the @W-1234@ mention from the issue description:

eventName: GithubEvents.events.ISSUE_EDITED,
fn: async function(req) {
const {
issue: { body: description },
changes
} = req.body;
const prevDescription = changes.body && changes.body.from;
const prevAnnotation = getAnnotation(prevDescription);
if (prevAnnotation && !isSameAnnotation(prevDescription, description)) {
sails.hooks['issues-hook'].queue.push(
{
name: 'UNLINK_WORK_ITEM',
workItemName: prevAnnotation
},

However for automatically created work items, there will not be a @W-1234@ mention in the issue description, since Git2Gus does not add one itself (only adds a GitHub comment saying "new work item created: LINK" etc). As such it seems to unlink these, one has to first add the @W-1234@ to the issue description and then remove it again, which should trigger the unlink.

I'm presuming also that another way to unlink either of the above cases, would be to manually edit the work item in GUS and clear the related_url__c field?

@mpsenn mpsenn added the bug Something isn't working label Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants