From b0cf2d153eb74c4501a3d4dfbb9cab9736784475 Mon Sep 17 00:00:00 2001 From: Jeremy Landis Date: Tue, 26 Dec 2023 17:30:25 -0500 Subject: [PATCH 1/5] [GHA] Do not run sonarcloud on forks --- .github/workflows/sonarcloud.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 43ca554a2..7f2e160f4 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -8,6 +8,7 @@ on: jobs: build: + if: github.repository_owner == 'damianszczepanik' runs-on: ubuntu-latest steps: From 7d8acbcfe7789770ec043ddf9c016e9d3619c86e Mon Sep 17 00:00:00 2001 From: Jeremy Landis Date: Thu, 28 Dec 2023 13:48:26 -0500 Subject: [PATCH 2/5] [GHA] Add comment as to why running on project owner only --- .github/workflows/sonarcloud.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 7f2e160f4..5e350046a 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -4,10 +4,11 @@ on: push: branches: - master - # do not validate pull requests because SONAR_TOKEN is available only for project owner + # Run against master only to not overwhelm sonar given master branch is the base used branch jobs: build: + # Do not run sonar on forks because SONAR_TOKEN is available only for project owner if: github.repository_owner == 'damianszczepanik' runs-on: ubuntu-latest From 5ed244a28ec4d042b2a713ade7be69b373c22372 Mon Sep 17 00:00:00 2001 From: Jeremy Landis Date: Sun, 31 Dec 2023 14:29:32 -0500 Subject: [PATCH 3/5] [GHA] Update all versions and use major only (which is always latest) --- .github/workflows/build.yml | 4 ++-- .github/workflows/codecov.yml | 6 +++--- .github/workflows/github-pages.yml | 6 +++--- .github/workflows/sonarcloud.yml | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1da95df2b..c86fc8b28 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,9 +20,9 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: java-version: ${{ matrix.java }} distribution: adopt diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 8649d11ff..1174fd92a 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -15,9 +15,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: java-version: 11 distribution: adopt @@ -25,4 +25,4 @@ jobs: - name: Generate code coverage run: mvn --batch-mode test - - uses: codecov/codecov-action@v3.1.0 + - uses: codecov/codecov-action@v3 diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index af54b4385..e45c5f663 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -11,9 +11,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: java-version: 11 distribution: adopt @@ -21,7 +21,7 @@ jobs: - name: Generate demo report run: mvn --batch-mode test - - uses: peaceiris/actions-gh-pages@v3.7.3 + - uses: peaceiris/actions-gh-pages@v3 with: external_repository: damianszczepanik/damianszczepanik.github.io personal_token: ${{ secrets.GH_PAGES_UPLOAD }} diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 5e350046a..d5e4f238c 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -13,11 +13,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: java-version: 11 distribution: adopt From 926b6053f9678d72628755a87810af39b0110dcb Mon Sep 17 00:00:00 2001 From: Jeremy Landis Date: Sun, 31 Dec 2023 14:30:01 -0500 Subject: [PATCH 4/5] [GHA] Add comment as to why ran on 'main' branch only --- .github/workflows/sonarcloud.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index d5e4f238c..650e79828 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -4,7 +4,7 @@ on: push: branches: - master - # Run against master only to not overwhelm sonar given master branch is the base used branch + # Community version only allows running against 'main' branch, see https://docs.sonarsource.com/sonarqube/latest/devops-platform-integration/github-integration/ jobs: build: From b1831ebba08a5ea7cdec2805a77d919bcd6dd9ea Mon Sep 17 00:00:00 2001 From: Jeremy Landis Date: Sun, 31 Dec 2023 14:30:17 -0500 Subject: [PATCH 5/5] [GHA] Do not run github-pages unless on main repo --- .github/workflows/github-pages.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index e45c5f663..d60a126ab 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -8,6 +8,8 @@ on: jobs: build: + # Do not run on forks as unnecessary + if: github.repository_owner == 'damianszczepanik' runs-on: ubuntu-latest steps: