How to perform a sonarqube analysis from in github?

0 votes

I am running sonar scans on github's pull requests from This is the procedure I am following:

  1. PR is made
  2. build is triggered
  3. Gradle task is executed
  4. Gradle's Sonar plugin with Drone's environment is run

The command I use in drone build:

gradle/wrapper all sonarqube \
 -Dsonar.analysis.mode=preview \
 -Dsonar.github.pullRequest=$DRONE_BUILD_NUMBER \

I am unable to find the PR ID in the drone environment. Is there any other way I can find it?

Jul 6, 2018 in Git & GitHub by Damon Salvatore
• 5,510 points

1 answer to this question.

0 votes

DRONE_PULL_REQUEST  env variable holds the pull request number(Check This). You can access all the environment variables through your build logs. You can do this by adding env command in your yaml file:

    image: golang
      - env # dump environment variables

Your build logs after execution:


Pull request is only set if drone is building a pull request hook.

answered Jul 6, 2018 by DareDev
• 6,810 points

Related Questions In Git & GitHub

0 votes
1 answer

Trying to analyse Sonarqube from in Github PRs

Just try the below steps.The DRONE_PULL_REQUEST environment variable has ...READ MORE

answered Jun 27, 2018 in Git & GitHub by shubham
• 6,910 points
0 votes
1 answer

How to give a file execute mode permissions in Git?

You can easily do this in one ...READ MORE

answered Aug 6, 2018 in Git & GitHub by Sophie may
• 9,900 points
0 votes
1 answer

How to add a remote git repository in Jenkins

Follow these steps: Step 1 Go to Manage ...READ MORE

answered May 23, 2019 in Git & GitHub by Alok
0 votes
1 answer
0 votes
2 answers

How to view the nested workflow of a local git repository?

The closest way to view branches in ...READ MORE

answered Aug 2, 2019 in Git & GitHub by Sirajul
• 45,590 points
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,400 points
0 votes
1 answer
0 votes
1 answer

How to do a re-merge into another branch in git

Seems like you want to rebase your ...READ MORE

answered May 7, 2018 in Git & GitHub by DareDev
• 6,810 points