I’m using GitHub and GitHub Actions (maven) to do my scanning.
In the new UI there is a section for Pull Requests, however this isn’t being populated.
However, my Pull Requests are listed in Branches, called ‘[391/merge]’ for example with PR# 391.
Is there a way to have these correctly picked up as Pull Requests and not as Branches?
Hi @Marcin_Majewski,
They just appear as Short-lived branches, same as normal branches.
Regards,
Terry
Hey @tsposato,
Can you share your GitHub action configuration? (with the private data removed)
Best,
Marcin
Hi @Marcin_Majewski,
Here are the relevant parts of my action:
on:
push:
branches-ignore:
- 'dependabot/**'
paths-ignore:
- 'infrastructure/**'
pull_request:
paths-ignore:
- 'infrastructure/**'
branches-ignore:
- 'dependabot/**'
jobs:
Build_Scan_Push_Images:
name: Build, Scan and Push Images
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK11
id: setup-jdk
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
${{ runner.os }}-
- name: Build & Scan
id: build-test-analyse-artifacts
env:
branch: ${{ steps.vars.outputs.branch_short }}
run: |
if [ "$branch" == "development" ]
then
echo "Running sonar scan of $branch against target of master"
mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.branch.name=development -Dsonar.branch.target=master
elif [ "$branch" == "master" ]
then
echo "Running sonar scan of $branch"
mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
else
echo "Running sonar scan of $branch against target of development"
mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.branch.name=$branch -Dsonar.branch.target=development
fi
Cheers,
Terry
Hey @tsposato,
You are missing -Dsonar.pullrequest.key
propery in order for your analysis to be detected as pull request.
Best,
Marcin