Skip to content

Commit e6a2e33

Browse files
author
Dennis Labordus
committed
Fixed GitHub Actions.
Signed-off-by: Dennis Labordus <[email protected]>
1 parent 4c8a13b commit e6a2e33

File tree

2 files changed

+37
-34
lines changed

2 files changed

+37
-34
lines changed
Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: 2022 Alliander N.V.
1+
# SPDX-FileCopyrightText: 2021 Alliander N.V.
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

@@ -12,31 +12,17 @@ jobs:
1212

1313
if: ${{ (github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]') || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }}
1414
steps:
15-
- name: add-new-issues-to-repository-based-project-column
16-
uses: docker://takanabe/github-actions-automate-projects:v0.0.1
17-
if: github.event_name == 'issues' && github.event.action == 'opened'
18-
env:
19-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20-
GITHUB_PROJECT_URL: https://github.com/com-pas/compas-scl-validator/projects/1
21-
GITHUB_PROJECT_COLUMN_NAME: To do
22-
- name: add-new-pull-request-to-repository-based-project-column
23-
uses: docker://takanabe/github-actions-automate-projects:v0.0.1
24-
if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.action == 'opened'
25-
env:
26-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27-
GITHUB_PROJECT_URL: https://github.com/com-pas/compas-scl-validator/projects/1
28-
GITHUB_PROJECT_COLUMN_NAME: To do
2915
- name: add-new-issues-to-organization-based-project-column
30-
uses: docker://takanabe/github-actions-automate-projects:v0.0.1
3116
if: github.event_name == 'issues' && github.event.action == 'opened'
32-
env:
33-
GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_ACTION_SECRET }}
34-
GITHUB_PROJECT_URL: https://github.com/orgs/com-pas/projects/1
35-
GITHUB_PROJECT_COLUMN_NAME: To do
17+
uses: alex-page/[email protected]
18+
with:
19+
project: CoMPAS Issues Overview Board
20+
column: To do
21+
repo-token: ${{ secrets.ORG_GITHUB_ACTION_SECRET }}
3622
- name: add-new-pull-request-to-organization-based-project-column
37-
uses: docker://takanabe/github-actions-automate-projects:v0.0.1
3823
if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.action == 'opened'
39-
env:
40-
GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_ACTION_SECRET }}
41-
GITHUB_PROJECT_URL: https://github.com/orgs/com-pas/projects/2
42-
GITHUB_PROJECT_COLUMN_NAME: To do
24+
uses: alex-page/[email protected]
25+
with:
26+
project: CoMPAS Pull Request Overview Board
27+
column: To do
28+
repo-token: ${{ secrets.ORG_GITHUB_ACTION_SECRET }}

.github/workflows/sonarcloud-analysis.yml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ jobs:
3030
with:
3131
fetch-depth: 0
3232
submodules: 'true'
33-
3433
- name: Set up JDK 17
3534
uses: actions/setup-java@v3
3635
with:
3736
distribution: 'zulu'
3837
java-version: '17'
38+
3939
- name: Cache SonarCloud packages
4040
uses: actions/cache@v3
4141
with:
@@ -49,20 +49,37 @@ jobs:
4949
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
5050
restore-keys: ${{ runner.os }}-m2
5151

52+
- name: Set Common Sonar Variables
53+
id: sonar_env
54+
run: |
55+
echo "##[set-output name=sonar_opts;]$(echo -Dsonar.host.url=https://sonarcloud.io \
56+
-Dsonar.projectKey=com-pas_compas-scl-validator \
57+
-Dsonar.organization=com-pas )"
5258
- name: Create custom Maven Settings.xml
5359
uses: whelk-io/maven-settings-xml-action@v20
5460
with:
5561
output_file: custom_maven_settings.xml
5662
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
57-
- name: Build and analyze
63+
- name: Build and analyze (Pull Request)
64+
if: ${{ github.event_name == 'pull_request' || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }}
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
68+
run: |
69+
./mvnw -B -s custom_maven_settings.xml -Psonar \
70+
${{ steps.sonar_env.outputs.sonar_opts }} \
71+
-Dsonar.pullrequest.branch=${{ github.ref_name }} \
72+
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }} \
73+
-Dsonar.pullrequest.base=${{ github.base_ref }} \
74+
-Dsonar.scm.revision=${{ github.event.pull_request.head.sha }} \
75+
clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
76+
- name: Build and analyze (Push)
77+
if: ${{ github.event_name == 'push' }}
5878
env:
59-
GITHUB_USERNAME: "OWNER"
6079
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6180
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
6281
run: |
63-
./mvnw -s custom_maven_settings.xml -B -Psonar \
64-
-Dsonar.projectKey=com-pas_compas-scl-validator \
65-
-Dsonar.organization=com-pas \
66-
-Dsonar.host.url=https://sonarcloud.io \
67-
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }} \
68-
clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
82+
./mvnw -B -s custom_maven_settings.xml -Psonar \
83+
${{ steps.sonar_env.outputs.sonar_opts }} \
84+
-Dsonar.branch.name=${{ github.ref_name }} \
85+
clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar

0 commit comments

Comments
 (0)