🔀 Merge pull request #80

Fix: GHSL-2020-244
This commit is contained in:
Ju4tCode 2020-11-26 20:23:32 +08:00 committed by GitHub
commit b2902407d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 10 deletions

View File

@ -1,7 +1,7 @@
name: Build API Doc name: Build API Doc
on: on:
pull_request_target: pull_request:
types: [ opened, synchronize, reopened ] types: [ opened, synchronize, reopened ]
jobs: jobs:
@ -12,7 +12,6 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
ref: ${{ github.event.pull_request.head.sha }} ref: ${{ github.event.pull_request.head.sha }}
token: ${{ secrets.GH_TOKEN }}
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v2 uses: actions/setup-python@v2
@ -32,11 +31,7 @@ jobs:
- name: Copy Files - name: Copy Files
run: cp -r ./build/markdown/* ./docs/api/ run: cp -r ./build/markdown/* ./docs/api/
- run: | - uses: actions/upload-artifact@v2
git config user.name nonebot with:
git config user.email nonebot@nonebot.dev name: docs
git add . path: docs/
git diff-index --quiet HEAD || git commit -m ":memo: update api docs"
git remote -vv
git remote add target ${{github.event.pull_request.head.repo.clone_url}}
git push target HEAD:${{github.event.pull_request.head.ref}}

33
.github/workflows/upload_docs.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: Upload API Doc
on:
workflow_run:
workflows: ["Build API Doc"]
types:
- completed
jobs:
upload:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.workflow_run.head_sha }}
token: ${{ secrets.GH_TOKEN }}
- uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: docs
path: docs/
- env:
REF: ${{ github.event.workflow_run.head_branch }}
run: |
git config user.name GitHub
git config user.email noreply@github.com
git add .
git diff-index --quiet HEAD || git commit -m ":memo: update api docs"
git remote add target "https://github.com/${{ github.event.workflow_run.head_repository.full_name }}.git"
git push target HEAD:$REF