From c1707d36d256d69259bc6de42e257090b77cd21f Mon Sep 17 00:00:00 2001 From: Doug <6060466+pixlwave@users.noreply.github.com> Date: Thu, 20 Mar 2025 08:45:38 +0000 Subject: [PATCH] Stop CI from uploading Codecov results when a PR comes from a fork. (#3917) Also fix the condition used on the Enterprise tests. --- .github/workflows/unit_tests.yml | 3 ++- .github/workflows/unit_tests_enterprise.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 7a6ff282a..198180b91 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -60,6 +60,7 @@ jobs: xcresultparser -q -o cobertura -t ElementX -p $(pwd) fastlane/test_output/PreviewTests.xcresult > fastlane/test_output/preview-cobertura.xml - name: Upload coverage to Codecov + if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} # Skip in forks uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3.1.6 with: fail_ci_if_error: true @@ -73,7 +74,7 @@ jobs: xcresultparser -q -o junit -p $(pwd) fastlane/test_output/PreviewTests.xcresult > fastlane/test_output/preview-junit.xml - name: Upload test results to Codecov - if: ${{ !cancelled() }} + if: ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} uses: codecov/test-results-action@f2dba722c67b86c6caa034178c6e4d35335f6706 #v1.1.0 continue-on-error: true with: diff --git a/.github/workflows/unit_tests_enterprise.yml b/.github/workflows/unit_tests_enterprise.yml index 5733e35f6..8c9d7a7ef 100644 --- a/.github/workflows/unit_tests_enterprise.yml +++ b/.github/workflows/unit_tests_enterprise.yml @@ -14,7 +14,7 @@ jobs: runs-on: macos-15 # Skip in forks - if: github.repository == 'element-hq/element-x-ios' + if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} concurrency: # Only allow a single run of this workflow on each branch, automatically cancelling older runs.