Gradle Plugin - Something went wrong while trying to get the pullrequest with key

  • ALM used GitHub
  • CI system used: GitHub Actions
  • Scanner command used when applicable ./gradlew build sonarqube --no-daemon --info
  • Languages of the repository: Java

I am trying to add sonarqube to a public repository and it keeps failing with “Something went wrong while trying to get the pullrequest with key”

Pull Request: Add sonarqube by billoneil · Pull Request #395 · StubbornJava/StubbornJava · GitHub

:sonarqube (Thread[Execution worker for ':',5,main]) completed. Took 14.931 secs.
* What went wrong:
27 actionable tasks: 27 executed
Execution failed for task ':sonarqube'.
> Something went wrong while trying to get the pullrequest with key '395'

The gradle plugin seems to give less debug output than the Maven plugin since it’s not saying why it failed to fetch the PR.

Hello Bill and welcome to the community forum!

So it seems this is happening because your SonarCloud organization is not bound anymore to the Github organization.
This could happen if you removed the SonarCloud application from your organization on Github. Re-installing it and binding again your SonarCloud organization should fix the error.

I saw that as a potential cause in some older threads so I have uninstalled and re-installed twice. The github indicator also says it is bound.

image

Ok so once your organization has the SonarCloud app installed and you can see the github indicator you should try restarting the Github Action that does the analysis.
Right now I see that the last run of your Github action was 5 days ago. Make sure you run it with the organization correctly bound.

Also it doesn’t seem to be bound right now:
image

I finally got back to testing this and wanted to share my findings.

The SonarCloud app was installed in the org with select repository access only to the single repo I want to test this on.

I was able to see the indicator stating the Github organization was not bound. The Github repository was being shown as bound as shown in my screen shot.

The fix was to grant SonarCloud access to ALL repositories which then showed the Github organization as being bound.

image

I re-ran the Github action and it was now successful.

I’m not sure if this is intended behavior or not so I thought I would mention it. This workaround is sufficient for me.

Thanks for the help.