From 8a6f6ff7d939b1874e3b0a518f8adf939af82bf6 Mon Sep 17 00:00:00 2001 From: yostyle Date: Tue, 8 Oct 2024 01:37:46 +0200 Subject: [PATCH] Disable jobs in fork --- .github/workflows/build_enterprise.yml | 2 +- .github/workflows/danger.yml | 4 +--- .github/workflows/generate_github_pages.yml | 2 +- .github/workflows/nightly.yml | 2 +- .github/workflows/quality.yml | 4 ++-- .github/workflows/release.yml | 4 ++-- .github/workflows/sync-localazy.yml | 2 +- .github/workflows/sync-sas-strings.yml | 2 +- .github/workflows/tests.yml | 4 ++-- 9 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build_enterprise.yml b/.github/workflows/build_enterprise.yml index a11176ae914..33920cbaedc 100644 --- a/.github/workflows/build_enterprise.yml +++ b/.github/workflows/build_enterprise.yml @@ -17,7 +17,7 @@ jobs: name: Build Enterprise APKs runs-on: ubuntu-latest # Skip in forks - if: ${{ github.repository == 'element-hq/element-x-android' }} + if: ${{ github.repository == 'element-hq/element-x-android' && ('pull_request' != github.event_name || github.event.pull_request.head.repo.full_name == github.repository) }} strategy: matrix: variant: [debug, release, nightly] diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index 0a3e430f8bf..7aa31bf8548 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest name: Danger main check # Skip in forks, it doesn't work even with the fallback token - if: ${{ github.repository == 'element-hq/element-x-android' }} + if: ${{ github.repository == 'element-hq/element-x-android' && ('pull_request' != github.event_name || github.event.pull_request.head.repo.full_name == github.repository) }} steps: - uses: actions/checkout@v4 - name: Add SSH private keys for submodule repositories @@ -15,8 +15,6 @@ jobs: with: ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }} - name: Clone submodules - # Skip in forks - if: ${{ github.repository == 'element-hq/element-x-android' }} run: git submodule update --init --recursive - run: | npm install --save-dev @babel/plugin-transform-flow-strip-types diff --git a/.github/workflows/generate_github_pages.yml b/.github/workflows/generate_github_pages.yml index 874947df4e9..6df98f8270d 100644 --- a/.github/workflows/generate_github_pages.yml +++ b/.github/workflows/generate_github_pages.yml @@ -9,7 +9,7 @@ jobs: generate-github-pages: runs-on: ubuntu-latest # Skip in forks - if: ${{ github.repository == 'element-hq/element-x-android' }} + if: ${{ github.repository == 'element-hq/element-x-android' && ('pull_request' != github.event_name || github.event.pull_request.head.repo.full_name == github.repository) }} steps: - name: ⏬ Checkout with LFS uses: nschloe/action-cached-lfs-checkout@v1.2.2 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index f6cab44e0aa..b8dac16fbd0 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -15,7 +15,7 @@ jobs: name: Build and publish nightly bundle to Firebase runs-on: ubuntu-latest # Skip in forks - if: ${{ github.repository == 'element-hq/element-x-android' }} + if: ${{ github.repository == 'element-hq/element-x-android' && ('pull_request' != github.event_name || github.event.pull_request.head.repo.full_name == github.repository) }} steps: - uses: actions/checkout@v4 - name: Use JDK 21 diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index 7d966f01d88..128bfaaf619 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -21,12 +21,12 @@ jobs: - name: Add SSH private keys for submodule repositories uses: webfactory/ssh-agent@v0.9.0 # Skip in forks - if: ${{ github.repository == 'element-hq/element-x-android' }} + if: ${{ github.repository == 'element-hq/element-x-android' && ('pull_request' != github.event_name || github.event.pull_request.head.repo.full_name == github.repository) }} with: ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }} - name: Clone submodules # Skip in forks - if: ${{ github.repository == 'element-hq/element-x-android' }} + if: ${{ github.repository == 'element-hq/element-x-android' && ('pull_request' != github.event_name || github.event.pull_request.head.repo.full_name == github.repository) }} run: git submodule update --init --recursive - name: Run code quality check suite run: ./tools/check/check_code_quality.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b44f3b4007e..a108fbcd7e3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,7 +43,7 @@ jobs: name: Create App Bundle Enterprise runs-on: ubuntu-latest # Skip in forks - if: ${{ github.repository == 'element-hq/element-x-android' }} + if: ${{ github.repository == 'element-hq/element-x-android' && ('pull_request' != github.event_name || github.event.pull_request.head.repo.full_name == github.repository) }} concurrency: group: ${{ format('build-release-main-enterprise-{0}', github.sha) }} cancel-in-progress: true @@ -52,7 +52,7 @@ jobs: - name: Add SSH private keys for submodule repositories uses: webfactory/ssh-agent@v0.9.0 # Skip in forks - if: ${{ github.repository == 'element-hq/element-x-android' }} + if: ${{ github.repository == 'element-hq/element-x-android' && ('pull_request' != github.event_name || github.event.pull_request.head.repo.full_name == github.repository) }} with: ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }} - name: Clone submodules diff --git a/.github/workflows/sync-localazy.yml b/.github/workflows/sync-localazy.yml index 65a1a758871..bc031cab427 100644 --- a/.github/workflows/sync-localazy.yml +++ b/.github/workflows/sync-localazy.yml @@ -9,7 +9,7 @@ jobs: sync-localazy: runs-on: ubuntu-latest # Skip in forks - if: ${{ github.repository == 'element-hq/element-x-android' }} + if: ${{ github.repository == 'element-hq/element-x-android' && ('pull_request' != github.event_name || github.event.pull_request.head.repo.full_name == github.repository) }} steps: - uses: actions/checkout@v4 - name: Use JDK 21 diff --git a/.github/workflows/sync-sas-strings.yml b/.github/workflows/sync-sas-strings.yml index 2d6c97f6efb..ec1365a3dec 100644 --- a/.github/workflows/sync-sas-strings.yml +++ b/.github/workflows/sync-sas-strings.yml @@ -9,7 +9,7 @@ jobs: sync-sas-strings: runs-on: ubuntu-latest # Skip in forks - if: ${{ github.repository == 'element-hq/element-x-android' }} + if: ${{ github.repository == 'element-hq/element-x-android' && ('pull_request' != github.event_name || github.event.pull_request.head.repo.full_name == github.repository) }} # No concurrency required, runs every time on a schedule. steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 56a88ed197d..94c33bb8304 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -41,12 +41,12 @@ jobs: - name: Add SSH private keys for submodule repositories uses: webfactory/ssh-agent@v0.9.0 # Skip in forks - if: ${{ github.repository == 'element-hq/element-x-android' }} + if: ${{ github.repository == 'element-hq/element-x-android' && ('pull_request' != github.event_name || github.event.pull_request.head.repo.full_name == github.repository) }} with: ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }} - name: Clone submodules # Skip in forks - if: ${{ github.repository == 'element-hq/element-x-android' }} + if: ${{ github.repository == 'element-hq/element-x-android' && ('pull_request' != github.event_name || github.event.pull_request.head.repo.full_name == github.repository) }} run: git submodule update --init --recursive - name: ☕️ Use JDK 21 uses: actions/setup-java@v4