Skip to content

Commit

Permalink
ci: Do not run code coverage on forks (#1900)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrey Kuleshov <andrewkuleshov7@gmail.com>
  • Loading branch information
marcospereira and orchestr7 committed Jan 10, 2024
1 parent 54a8030 commit 65d7ba9
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ jobs:
retention-days: 1
- name: Code coverage report
uses: codecov/codecov-action@v3
# Do not run coverage for forks since they cannot upload the results to codecov.
# For reference, see:
# https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution#example-only-run-job-for-specific-repository
if: github.repository == 'saveourtool/diktat'
with:
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
Expand All @@ -91,9 +95,6 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
# required for correct codecov upload
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
Expand Down Expand Up @@ -154,15 +155,10 @@ jobs:
name: gradle-test-report-${{ matrix.os }}
path: '**/build/reports/'
retention-days: 1
- name: Code coverage report
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}

- name: 'Publish a snapshot to GitHub'
id: publish-github
if: ${{ github.event_name == 'push' && github.ref_type == 'branch' && github.ref == 'refs/heads/master' }}
if: ${{ github.event_name == 'push' && github.ref_type == 'branch' && github.ref == 'refs/heads/master' && github.repository == 'saveourtool/diktat' }}
uses: gradle/gradle-build-action@v2
with:
gradle-version: wrapper
Expand All @@ -172,7 +168,7 @@ jobs:
- name: 'Publish a snapshot to Maven Central'
id: publish-sonatype
if: ${{ github.event_name == 'push' && github.ref_type == 'branch' && github.ref == 'refs/heads/master' }}
if: ${{ github.event_name == 'push' && github.ref_type == 'branch' && github.ref == 'refs/heads/master' && github.repository == 'saveourtool/diktat' }}
uses: gradle/gradle-build-action@v2
with:
gradle-version: wrapper
Expand Down

0 comments on commit 65d7ba9

Please sign in to comment.