Skip to content

Commit 2db61c3

Browse files
authored
Fix build workflow for forks (#115)
1 parent 7c576c4 commit 2db61c3

1 file changed

Lines changed: 10 additions & 15 deletions

File tree

.github/workflows/build.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ on:
55
branches:
66
- main
77
paths-ignore:
8-
- '*.md'
9-
- '.github/**/*.yml'
8+
- "*.md"
9+
- ".github/**/*.yml"
1010
tags:
11-
- '[0-9]+.[0-9]+.[0-9]+'
11+
- "[0-9]+.[0-9]+.[0-9]+"
1212
pull_request:
13-
types: [ opened, synchronize, reopened ]
13+
types: [opened, synchronize, reopened]
1414

1515
jobs:
1616
build:
@@ -22,32 +22,27 @@ jobs:
2222
- name: Checkout
2323
uses: actions/checkout@v4
2424
with:
25-
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
25+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
2626

2727
- name: Set up JDK 17
28-
uses: actions/setup-java@v3
28+
uses: actions/setup-java@v4
2929
with:
30-
distribution: 'temurin'
30+
distribution: "temurin"
3131
java-version: 17
32-
33-
- name: Cache Maven packages
34-
uses: actions/cache@v3
35-
with:
36-
path: ~/.m2
37-
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
38-
restore-keys: ${{ runner.os }}-m2
32+
cache: maven
3933

4034
- name: Verify
4135
run: ./mvnw -e -B verify
4236

4337
- name: Cache SonarQube packages
44-
uses: actions/cache@v3
38+
uses: actions/cache@v4
4539
with:
4640
path: ~/.sonar/cache
4741
key: ${{ runner.os }}-sonar
4842
restore-keys: ${{ runner.os }}-sonar
4943

5044
- name: SonarQube Scan
45+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
5146
env:
5247
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5348
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)