Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Do not run code coverage on forks #1900

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading