Skip to content

Commit 30cc9f6

Browse files
committed
Chore: Update CI action
Lock actions to specific versions rather than master. The cache action has hung sometimes causing the build to fail. I'm hoping this addresses that and prevents future regressions. Modify the if condition on snyk and sonarcloud to run on pull_requests as well as push. Add check against repository_owner so a fork doesn't fail because of a missing secret.
1 parent baef3b1 commit 30cc9f6

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
artifact:
2020
runs-on: ubuntu-latest
2121
steps:
22-
- uses: actions/checkout@master
22+
- uses: actions/checkout@v2
2323
- name: Set up JDK 8
24-
uses: actions/setup-java@master
24+
uses: actions/setup-java@v1
2525
with:
2626
java-version: 8
2727
- name: Set artifact version
@@ -30,7 +30,7 @@ jobs:
3030
- name: Stage artifacts
3131
run: mvn -B -DaltDeploymentRepository=ossrh::default::file:snapshot/ deploy
3232
- name: Package artifacts
33-
uses: actions/upload-artifact@master
33+
uses: actions/upload-artifact@v2
3434
if: success()
3535
with:
3636
name: jsonurl-maven-repository
@@ -45,9 +45,9 @@ jobs:
4545
os: [macos-latest, ubuntu-latest, windows-latest]
4646
jdk: [8, 9, 10, 11, 12]
4747
steps:
48-
- uses: actions/checkout@master
48+
- uses: actions/checkout@v2
4949
- name: Set up JDK ${{ matrix.jdk }}
50-
uses: actions/setup-java@master
50+
uses: actions/setup-java@v1
5151
with:
5252
java-version: ${{ matrix.jdk }}
5353
- name: Cache Maven dependencies
@@ -66,35 +66,34 @@ jobs:
6666
snyk:
6767
needs: artifact
6868
if: |
69-
github.event_name == 'push'
70-
&& endsWith( github.ref, '/master' )
71-
&& needs.artifact.result == 'success'
69+
needs.artifact.result == 'success'
70+
&& github.repository_owner == 'jsonurl'
7271
runs-on: ubuntu-latest
7372
steps:
74-
- uses: actions/checkout@master
75-
- name: Run Snyk to check for vulnerabilities
73+
- uses: actions/checkout@v2
74+
- name: Run Snyk to check ${{ github.ref }} for vulnerabilities
7675
uses: snyk/actions/maven-3-jdk-11@master
7776
env:
7877
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
7978

8079
sonarcloud:
8180
needs: artifact
8281
if: |
83-
github.event_name == 'push'
84-
&& endsWith( github.ref, '/master' )
85-
&& needs.artifact.result == 'success'
82+
needs.artifact.result == 'success'
83+
&& github.repository_owner == 'jsonurl'
8684
runs-on: ubuntu-latest
8785
steps:
88-
- uses: actions/checkout@master
89-
- run: git fetch --unshallow
86+
- uses: actions/checkout@v2
87+
with:
88+
fetch-depth: 0
9089
- name: Set up JDK 11
91-
uses: actions/setup-java@master
90+
uses: actions/setup-java@v1
9291
with:
9392
java-version: 11
9493
- name: Set artifact version
9594
run: script/version_snapshot.sh
9695
shell: bash
97-
- name: SonarCloud Scan
96+
- name: SonarCloud scan of ${{ github.ref }}
9897
run: mvn -P jacoco -B -Dsonar.projectKey=jsonurl_jsonurl-java -Dsonar.organization=jsonurl -Dsonar.host.url=https://sonarcloud.io package sonar:sonar
9998
env:
10099
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)