From ce77293ce4a9f28193fb7aadf87d106fa8b8680c Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Sun, 8 Sep 2024 19:26:46 +0700 Subject: [PATCH 1/3] Skip comment when CI not running from opengisch repository --- .github/workflows/android.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 06bd8c0952..d5f058986e 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -13,6 +13,9 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true +env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + jobs: build: runs-on: ubuntu-22.04 @@ -52,8 +55,6 @@ jobs: qt_arch: 'android_x86' all_files_access: 'ON' artifact_name: 'android-x86' - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} steps: - name: 🐣 Checkout @@ -223,7 +224,7 @@ jobs: name: deploy to play store runs-on: ubuntu-20.04 needs: build - if: ${{ github.event_name == 'release' || ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) }} + if: ${{ ( github.event_name == 'release' || ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) ) && env.SENTRY_AUTH_TOKEN != '' }} steps: - name: Checkout uses: actions/checkout@v4 @@ -264,7 +265,7 @@ jobs: name: comment (pr) runs-on: ubuntu-20.04 needs: build - if: ${{ github.event_name == 'pull_request' }} + if: ${{ github.event_name == 'pull_request' && env.SENTRY_AUTH_TOKEN != '' }} steps: - name: Checkout uses: actions/checkout@v4 @@ -295,7 +296,7 @@ jobs: name: comment (commit) runs-on: ubuntu-20.04 needs: build - if: ${{ github.event_name == 'push' }} + if: ${{ github.event_name == 'push' && env.SENTRY_AUTH_TOKEN != '' }} steps: - name: Checkout uses: actions/checkout@v4 From 5ddba2ecca2df78b6183daaeee2e8854771a7332 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Mon, 9 Sep 2024 09:44:22 +0700 Subject: [PATCH 2/3] Avoid daily workflow failure notifications on 3rd party repositories --- .github/workflows/apple_certs.yml | 1 + .github/workflows/s3clean.yml | 1 + .github/workflows/sync-translations.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/apple_certs.yml b/.github/workflows/apple_certs.yml index 892d40b2c9..b6b77b34d3 100644 --- a/.github/workflows/apple_certs.yml +++ b/.github/workflows/apple_certs.yml @@ -10,6 +10,7 @@ jobs: sync_certs: name: sync certs runs-on: macos-12 + if: ${{ github.repository == 'opengisch/QField' }} steps: - name: 🐣 Checkout diff --git a/.github/workflows/s3clean.yml b/.github/workflows/s3clean.yml index 34d0cc0fed..9714751702 100644 --- a/.github/workflows/s3clean.yml +++ b/.github/workflows/s3clean.yml @@ -7,6 +7,7 @@ on: jobs: clean_s3: runs-on: ubuntu-22.04 + if: ${{ github.repository == 'opengisch/QField' }} steps: - run: | sudo apt install -y s3cmd diff --git a/.github/workflows/sync-translations.yml b/.github/workflows/sync-translations.yml index f3107d3bb1..f66f67ffcb 100644 --- a/.github/workflows/sync-translations.yml +++ b/.github/workflows/sync-translations.yml @@ -7,6 +7,7 @@ on: jobs: sync_translations: runs-on: ubuntu-22.04 + if: ${{ github.repository == 'opengisch/QField' }} steps: - uses: actions/checkout@v4 with: From 07f820096e0142f3d4a07b088149a889271e6fa8 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Mon, 9 Sep 2024 09:55:24 +0700 Subject: [PATCH 3/3] Can't refer to env.* for job ifs --- .github/workflows/android.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index d5f058986e..3d1d289fa3 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -224,17 +224,20 @@ jobs: name: deploy to play store runs-on: ubuntu-20.04 needs: build - if: ${{ ( github.event_name == 'release' || ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) ) && env.SENTRY_AUTH_TOKEN != '' }} + if: ${{ ( github.event_name == 'release' || ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) ) }} steps: - name: Checkout uses: actions/checkout@v4 + if: ${{ env.SENTRY_AUTH_TOKEN != '' }} - name: Vars id: vars + if: ${{ env.SENTRY_AUTH_TOKEN != '' }} run: | ./scripts/ci/env_gh.sh - name: Download apks + if: ${{ env.SENTRY_AUTH_TOKEN != '' }} run: | wget https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-arm64.apk wget https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-arm-neon.apk @@ -242,6 +245,7 @@ jobs: wget https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-x86.apk - name: Upload to Google Play Store + if: ${{ env.SENTRY_AUTH_TOKEN != '' }} run: | pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib oauth2client @@ -265,17 +269,21 @@ jobs: name: comment (pr) runs-on: ubuntu-20.04 needs: build - if: ${{ github.event_name == 'pull_request' && env.SENTRY_AUTH_TOKEN != '' }} + if: ${{ github.event_name == 'pull_request' }} steps: - name: Checkout uses: actions/checkout@v4 + if: ${{ env.SENTRY_AUTH_TOKEN != '' }} + - name: Vars id: vars + if: ${{ env.SENTRY_AUTH_TOKEN != '' }} run: | ./scripts/ci/env_gh.sh - name: 💬 Create comment uses: marocchino/sticky-pull-request-comment@v2 + if: ${{ env.SENTRY_AUTH_TOKEN != '' }} with: GITHUB_TOKEN: ${{ secrets.FAIRY_TOKEN }} message: | @@ -296,16 +304,21 @@ jobs: name: comment (commit) runs-on: ubuntu-20.04 needs: build - if: ${{ github.event_name == 'push' && env.SENTRY_AUTH_TOKEN != '' }} + if: ${{ github.event_name == 'push' }} steps: - name: Checkout uses: actions/checkout@v4 + if: ${{ env.SENTRY_AUTH_TOKEN != '' }} + - name: Vars id: vars + if: ${{ env.SENTRY_AUTH_TOKEN != '' }} run: | ./scripts/ci/env_gh.sh + - name: Comment commit uses: peter-evans/commit-comment@v3 + if: ${{ env.SENTRY_AUTH_TOKEN != '' }} with: token: ${{ secrets.FAIRY_TOKEN }} body: |