-
Notifications
You must be signed in to change notification settings - Fork 12
43 lines (38 loc) · 1.46 KB
/
sonar-test-pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Maven Pull Request Sonar Test
on:
workflow_run:
workflows: [Maven Pull Request Build]
types:
- completed
jobs:
on-success:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_repository.fork == true }}
steps:
- name: Fetch PR number
id: fetch
uses: FraunhoferIOSB/pull-request-number-action@v0.1.0
with:
repo-to-check: '${{ github.event.workflow_run.repository.url }}'
name-of-pr: '${{ github.event.workflow_run.head_branch }}'
- uses: actions/checkout@v4
with:
repository: '${{ github.event.workflow_run.head_repository.full_name }}'
ref: '${{ github.event.workflow_run.head_branch }}'
- name: Test with Sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: >
mvn install sonar:sonar -P coverage
-Dsonar.projectKey=FraunhoferIOSB_FAAAST-Service
-Dsonar.pullrequest.key='${{ steps.fetch.outputs.pr-number }}'
-Dsonar.pullrequest.branch='${{ github.event.workflow_run.head_branch }}'
-Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }}
--settings maven-ci-settings.xml
-B
on-failure:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: echo 'The triggering workflow failed'