From babd6edbc2539317d02ff302b4f5e4a71256827d Mon Sep 17 00:00:00 2001 From: Ylarod Date: Tue, 17 Jan 2023 16:20:36 +0800 Subject: [PATCH] [skip ci] check BOT_TOKEN before step run --- .github/workflows/build-kernel-5.10.yml | 13 +++++++++++-- .github/workflows/build-kernel-5.15.yml | 12 ++++++++++-- .github/workflows/build-manager.yml | 12 ++++++++++-- .github/workflows/build-su.yml | 13 +++++++++++-- 4 files changed, 42 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-kernel-5.10.yml b/.github/workflows/build-kernel-5.10.yml index 522b541e..4bd4e919 100644 --- a/.github/workflows/build-kernel-5.10.yml +++ b/.github/workflows/build-kernel-5.10.yml @@ -38,6 +38,15 @@ jobs: name: Build aarch64-${{ matrix.version }} runs-on: ubuntu-latest steps: + - name: Setup need_upload + id: need_upload + run: | + if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then + echo "UPLOAD=true" >> $GITHUB_OUTPUT + else + echo "UPLOAD=false" >> $GITHUB_OUTPUT + fi + - uses: actions/checkout@v3 with: path: KernelSU @@ -125,10 +134,10 @@ jobs: path: android-kernel/out/android12-5.10/dist/boot-gz.img - name: Setup mutex for uploading - if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request' && steps.need_upload.output == 'true' uses: ben-z/gh-action-mutex@v1.0-alpha-7 - name: Upload to telegram - if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request' && steps.need_upload.output == 'true' env: CHAT_ID: ${{ secrets.CHAT_ID }} CACHE_CHAT_ID: ${{ secrets.CACHE_CHAT_ID }} diff --git a/.github/workflows/build-kernel-5.15.yml b/.github/workflows/build-kernel-5.15.yml index 1edc9006..92df9814 100644 --- a/.github/workflows/build-kernel-5.15.yml +++ b/.github/workflows/build-kernel-5.15.yml @@ -26,6 +26,14 @@ jobs: name: Build aarch64-${{ matrix.version }} runs-on: ubuntu-latest steps: + - name: Setup need_upload + id: need_upload + run: | + if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then + echo "UPLOAD=true" >> $GITHUB_OUTPUT + else + echo "UPLOAD=false" >> $GITHUB_OUTPUT + fi - uses: actions/checkout@v3 with: path: KernelSU @@ -83,9 +91,9 @@ jobs: - name: Setup mutex for uploading uses: ben-z/gh-action-mutex@v1.0-alpha-7 - if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request' && steps.need_upload.output == 'true' - name: Upload to telegram - if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request' && steps.need_upload.output == 'true' env: CHAT_ID: ${{ secrets.CHAT_ID }} CACHE_CHAT_ID: ${{ secrets.CACHE_CHAT_ID }} diff --git a/.github/workflows/build-manager.yml b/.github/workflows/build-manager.yml index 19ffbf6c..da36e070 100644 --- a/.github/workflows/build-manager.yml +++ b/.github/workflows/build-manager.yml @@ -20,6 +20,14 @@ jobs: run: working-directory: ./manager steps: + - name: Setup need_upload + id: need_upload + run: | + if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then + echo "UPLOAD=true" >> $GITHUB_OUTPUT + else + echo "UPLOAD=false" >> $GITHUB_OUTPUT + fi - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -70,9 +78,9 @@ jobs: path: manager/app/build/outputs/apk/release/*.apk - name: Setup mutex for uploading uses: ben-z/gh-action-mutex@v1.0-alpha-7 - if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request' && steps.need_upload.output == 'true' - name: Upload to telegram - if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request' && steps.need_upload.output == 'true' env: CHAT_ID: ${{ secrets.CHAT_ID }} CACHE_CHAT_ID: ${{ secrets.CACHE_CHAT_ID }} diff --git a/.github/workflows/build-su.yml b/.github/workflows/build-su.yml index 409d48fe..84fad3df 100644 --- a/.github/workflows/build-su.yml +++ b/.github/workflows/build-su.yml @@ -15,6 +15,15 @@ jobs: name: Build userspace su runs-on: ubuntu-latest steps: + - name: Setup need_upload + id: need_upload + run: | + if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then + echo "UPLOAD=true" >> $GITHUB_OUTPUT + else + echo "UPLOAD=false" >> $GITHUB_OUTPUT + fi + - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -32,9 +41,9 @@ jobs: path: ./userspace/su/libs - name: Setup mutex for uploading uses: ben-z/gh-action-mutex@v1.0-alpha-7 - if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request' && steps.need_upload.output == 'true' - name: Upload to telegram - if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request' && steps.need_upload.output == 'true' env: CHAT_ID: ${{ secrets.CHAT_ID }} CACHE_CHAT_ID: ${{ secrets.CACHE_CHAT_ID }}