ci: only run when have secret

This commit is contained in:
yihong0618 2023-03-05 12:21:26 +08:00
parent 4219f9c31d
commit 671957f0b4

View File

@ -9,6 +9,7 @@ on:
env: env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true ACTIONS_ALLOW_UNSECURE_COMMANDS: true
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
jobs: jobs:
testing: testing:
@ -31,8 +32,10 @@ jobs:
- name: install python requirements - name: install python requirements
run: pip install -r requirements.txt run: pip install -r requirements.txt
- name: make test ebook - name: make test ebook
if: env.OPENAI_API_KEY != null
run: python3 make_book.py --book_name "test_books/${{ env.EPUB_FILENAME_BASE}}.epub" --no_limit --test --test_num 2 --language zh-hans --openai_key ${{secrets.OPENAI_API_KEY }} run: python3 make_book.py --book_name "test_books/${{ env.EPUB_FILENAME_BASE}}.epub" --no_limit --test --test_num 2 --language zh-hans --openai_key ${{secrets.OPENAI_API_KEY }}
- name: Rename and Upload ePub - name: Rename and Upload ePub
if: env.OPENAI_API_KEY != null
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: epub_output name: epub_output