atlassian / github-for-jira

Connect your code with your project management in Jira
https://github.atlassian.com
MIT License
619 stars 188 forks source link

Pull Request descriptions being edited by Jira #1820

Open nicholasspencer opened 1 year ago

nicholasspencer commented 1 year ago

It seems like there was a recent change that was introduced which is constantly editing our pull request descriptions. It looks like something is pattern matching the ticket format and then appending a (poorly formatted imo) bit of text at the end.

A few issues with this. We squash our PRs and merge in the description of the PR as the commit message. We also use git trailers which are expected to be at the end of the commit. The bot appending it's own information at the end messes with this.

Another thing... it doesn't even work correctly. We have a PR template which contains docblocks explaining parts of the template. This is the explanation on using git trailers along with the ticket for the PR that I added, and the line that the bot injected.

## Context

<!--
Use commit trailers to add additional context such as the assigned Jira ticket, related Jira tickets, and related Github Pull Requests.

https://git-scm.com/docs/git-interpret-trailers

Example:
related-to: MW-1234
related-to: resideo/lantern_flutter#<pr number>
ticket: MW-5678
-->

ticket: MW-6010

[MW-1234]: https://resideo.atlassian.net/browse/MW-1234?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

As you can see the [MW-1234]: http://resideo... bit at the end was injected because it picked up the fake/example ticket number from ticket: MW-1234 which is in a docblock. The real ticket was MW-6010 which was in the proper place for the trailer until the Jira integration comes stomping through.

Is there anyway to turn this behavior off?

krazziekay commented 1 year ago

Hi @nicholasspencer , we did recently push a fix for correcting the links to the Jira issue tickets in GitHub's PR. That is probably whats causing this behaviour. I will look into this and have it resolved quickly.

krazziekay commented 1 year ago

@nicholasspencer The fix has been merged and will be deployed soon. Please test it again.

nicholasspencer commented 1 year ago

Looks like that did the trick. Thank you very much!

nicholasspencer commented 1 year ago

Seems like this is happening again.

RafalSkolasinski commented 1 year ago

Happening for us as well

nicholasspencer commented 1 year ago

And again...

malyavi-nochum commented 1 year ago

Is there any way to shut off this automation? It's causing a lot of issues with our CI

rs21brady commented 1 year ago

happeningagain

nicholasspencer commented 1 year ago

And again. Please add an integration test to prevent this behavior or add a flag or something to the GitHub app to turn this on and off...

cleverer commented 11 months ago

Same issue here… very annoying to not even have options to disable this. As we already have set up Autolink References

bikram-agarwal commented 9 months ago

I'm having the same issue, in even weirder way. I'm using Jira Automation Rule to automatically create pull requests in GitHub. The Jira Automation Rule sends a web request to GitHub REST API endpoint (https://api.github.com/repos/$org/$repo/pulls) with this custom data -

{
    "title": "{{issue.key}}: PR to qa",
    "body": "PR auto-created from Jira Issue [{{issue.key}}]({{issue.url}})",
    "head": "feature/{{issue.key}}",
    "base": "qa"
}

The pull request is getting created fine. But immediately afterwards, the jira (bot) is editing the PR body, to add some hidden code to it. Body looks same before and after the editing done by jira (bot) -

PR auto-created from Jira Issue EXMPL-12345

But when I check the source code of body after jira (bot)'s editing, looks like it adds a second line to it - Body source code after Jira (bot) edits it -

PR auto-created from Jira Issue [EXMPL-12345](https://myorg.atlassian.net/browse/EXMPL-12345)

[EXMPL-12345]: https://myorg.atlassian.net/browse/EXMPL-12345?atlOrigin=loNgAlphaNumericStringHere

I dislike this behavior, because we have CI jobs configured in GitHub that get triggered when a PR is edited. So, this behavior of the jira (bot) is unnecessarily triggering those CI jobs.

I need to stop this. Please let me know how.

BenedekFarkas commented 9 months ago

Can confirm it's happening with issue and PR descriptions, also related: https://github.com/atlassian/github-for-jira/issues/2046

pascal-hofmann commented 8 months ago

We also experience this issue. We use renovate to update dependencies. It creates pull requests that get edited by github-for-jira. Renovate does not like the edits and reverts all the changes with another edit. Then github-fot-jira edits again and we end up with hundreds of edits.

imishchuk-carbon commented 8 months ago

Hey, folks.

We're experiencing this too. In our case we run some jobs on PRs being opened, edited, synchronized. So when jira bot edits the PR it triggers redundant job execution, which in turn costs us money/resources.

magnetikonline commented 5 months ago

We're getting this as well.

Would really like there to be a Jira -> GitHub "read only" mode that could be set at an instance/project level.

Love that Jira can associate pull requests with Jira tickets/etc. - but in no way want Jira messing with our GitHub state. Hate this.