github-for-jira icon indicating copy to clipboard operation
github-for-jira copied to clipboard

PR status is not propagating correctly with closed draft PRs

Open michaellarocca90 opened this issue 2 years ago • 17 comments

We use a 3rd party merge queueing system that will create a draft PR (which is never upgraded into an open PR) that batches multiple change sets together for CI evaluation. This draft PR contains the commit with the Issue-ID prefix and is linked to the PR. The PR creation and merge commit actions are performed via an internal automation user and when that users closes the PR the state doesn't transition from Open in Jira to Closed or Declined. The PR never enters the "open" PR state.

Am I correct in assuming that if a PR is closed it would show up as Declined in Jira?

This is blocking automation around closing issues as the development[pullrequests].open = 0 evaluates to false.

  1. Is this a bug that draft PR state doesn't propagate correctly into Jira?

  2. ~~Is this a case of https://github.com/atlassian/github-for-jira/blob/main/SUPPORT.md#workflow-transitions-are-not-running. I briefly looked into this but the patch files for the merge commits are on behalf of the user (who has Jira permissions) and not the automation user. Pr creation is done by the automation user though. It would be strange to me that the creation event would get picked up but then the transition from Open to Declined.~~. I tested this theory and disproved it.

  3. Is there a way to bypass this bug and target my automation around a single closed Pull Request? development[pullrequests].merged = 1 (this is invalid jql)... I am having trouble finding documentation around the schema for this field.

michaellarocca90 avatar Jun 28 '22 23:06 michaellarocca90

Found info related to #3 here https://support.atlassian.com/jira-software-cloud/docs/advanced-search-reference-jql-developer-status/. Doesn't seem like there is any way to target a single closed PR with jql syntax.

michaellarocca90 avatar Jun 29 '22 00:06 michaellarocca90

For clarity, the PR is always in a draft state and never upgraded to an open PR status?

mboudreau avatar Jun 29 '22 00:06 mboudreau

@mboudreau Yes

michaellarocca90 avatar Jun 29 '22 00:06 michaellarocca90

Any thoughts here?

michaellarocca90 avatar Jul 08 '22 16:07 michaellarocca90

@mboudreau do you need something else from me or can we remove the "awaiting-response" and "question" label?

michaellarocca90 avatar Aug 02 '22 22:08 michaellarocca90

I confirmed that #2 is not an issue.

michaellarocca90 avatar Aug 13 '22 21:08 michaellarocca90

If I can get some help triaging this issue I'd be happy to fix it

michaellarocca90 avatar Aug 16 '22 21:08 michaellarocca90

I would also be willing to contribute to this, if we could get a nudge in the right direction.

sholsapp avatar Aug 16 '22 22:08 sholsapp

Hey @sholsapp and @michaellarocca90. We'd be happy for one of you to tackle this one. What do you mean by a nudge in the right direction?

rachellerathbone avatar Aug 25 '22 04:08 rachellerathbone

@rachellerathbone what I meant was maybe a pointer to where in the code the maintainers would start. I've never worked on this codebase before so don't know what important objects, architecture patterns, gotchas, etc., exist. If there's an obvious starting point, that'd be great. 😄

sholsapp avatar Aug 29 '22 16:08 sholsapp

Ping! Friendly reminder we'd be willing to contribute a fix if you can give us a high level sense of where to start looking.

sholsapp avatar Oct 18 '22 17:10 sholsapp

Important fix for us @rachellerathbone could we get a little help?

gregbrunet avatar Oct 18 '22 17:10 gregbrunet

Hey all. We had someone on our team do some investigatory work on this one. Unfortunately, it looks like it would require changes in several locations (so not solely the GitHub for Jira integration) so this would need to be picked up by an Atlassian employee. I have created a ticket in our backlog.

rachellerathbone avatar Oct 19 '22 04:10 rachellerathbone

@rachellerathbone was something done here? I believe I'm seeing a change on our end that the draft PR's are getting marked as Declined and the Issue is accurately reporting Merged on the PR.

michaellarocca90 avatar Nov 04 '22 20:11 michaellarocca90

Actually, it seems like it's not fixed. It was for a brief period reporting Declined, now we are back to Open

michaellarocca90 avatar Nov 08 '22 19:11 michaellarocca90

Hi @rachellerathbone , just curious where this issue sits on the roadmap. We're still needing to manually close all our tickets due to this issue

wtait1-ff avatar Jan 23 '23 19:01 wtait1-ff

Hi @rachellerathbone, we recently saw ticket begin to autoclose again and wanted to check and see if you fixed something on your end.

michaellarocca90 avatar May 24 '23 22:05 michaellarocca90