[skip ci] check BOT_TOKEN before step run

This commit is contained in:
Ylarod
2023-01-17 16:20:36 +08:00
parent 2a1e91cb34
commit babd6edbc2
4 changed files with 42 additions and 8 deletions

View File

@@ -38,6 +38,15 @@ jobs:
name: Build aarch64-${{ matrix.version }} name: Build aarch64-${{ matrix.version }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: 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 - uses: actions/checkout@v3
with: with:
path: KernelSU path: KernelSU
@@ -125,10 +134,10 @@ jobs:
path: android-kernel/out/android12-5.10/dist/boot-gz.img path: android-kernel/out/android12-5.10/dist/boot-gz.img
- name: Setup mutex for uploading - 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 uses: ben-z/gh-action-mutex@v1.0-alpha-7
- name: Upload to telegram - name: Upload to telegram
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request' && steps.need_upload.output == 'true'
env: env:
CHAT_ID: ${{ secrets.CHAT_ID }} CHAT_ID: ${{ secrets.CHAT_ID }}
CACHE_CHAT_ID: ${{ secrets.CACHE_CHAT_ID }} CACHE_CHAT_ID: ${{ secrets.CACHE_CHAT_ID }}

View File

@@ -26,6 +26,14 @@ jobs:
name: Build aarch64-${{ matrix.version }} name: Build aarch64-${{ matrix.version }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: 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 - uses: actions/checkout@v3
with: with:
path: KernelSU path: KernelSU
@@ -83,9 +91,9 @@ jobs:
- name: Setup mutex for uploading - name: Setup mutex for uploading
uses: ben-z/gh-action-mutex@v1.0-alpha-7 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 - name: Upload to telegram
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request' && steps.need_upload.output == 'true'
env: env:
CHAT_ID: ${{ secrets.CHAT_ID }} CHAT_ID: ${{ secrets.CHAT_ID }}
CACHE_CHAT_ID: ${{ secrets.CACHE_CHAT_ID }} CACHE_CHAT_ID: ${{ secrets.CACHE_CHAT_ID }}

View File

@@ -20,6 +20,14 @@ jobs:
run: run:
working-directory: ./manager working-directory: ./manager
steps: 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 - uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
@@ -70,9 +78,9 @@ jobs:
path: manager/app/build/outputs/apk/release/*.apk path: manager/app/build/outputs/apk/release/*.apk
- name: Setup mutex for uploading - name: Setup mutex for uploading
uses: ben-z/gh-action-mutex@v1.0-alpha-7 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 - name: Upload to telegram
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request' && steps.need_upload.output == 'true'
env: env:
CHAT_ID: ${{ secrets.CHAT_ID }} CHAT_ID: ${{ secrets.CHAT_ID }}
CACHE_CHAT_ID: ${{ secrets.CACHE_CHAT_ID }} CACHE_CHAT_ID: ${{ secrets.CACHE_CHAT_ID }}

View File

@@ -15,6 +15,15 @@ jobs:
name: Build userspace su name: Build userspace su
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: 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 - uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
@@ -32,9 +41,9 @@ jobs:
path: ./userspace/su/libs path: ./userspace/su/libs
- name: Setup mutex for uploading - name: Setup mutex for uploading
uses: ben-z/gh-action-mutex@v1.0-alpha-7 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 - name: Upload to telegram
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request' && steps.need_upload.output == 'true'
env: env:
CHAT_ID: ${{ secrets.CHAT_ID }} CHAT_ID: ${{ secrets.CHAT_ID }}
CACHE_CHAT_ID: ${{ secrets.CACHE_CHAT_ID }} CACHE_CHAT_ID: ${{ secrets.CACHE_CHAT_ID }}