2020-11-26 20:18:36 +08:00
|
|
|
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 }}
|
2020-11-26 20:53:28 +08:00
|
|
|
PR_REPO: ${{ github.event.workflow_run.head_repository.full_name }}
|
|
|
|
PR_USER: ${{ github.event.workflow_run.head_repository.owner.login }}
|
2020-11-26 20:18:36 +08:00
|
|
|
run: |
|
2020-11-26 20:53:28 +08:00
|
|
|
git config user.name $PR_USER
|
|
|
|
git config user.email $PR_USER@users.noreply.github.com
|
2020-11-26 20:18:36 +08:00
|
|
|
git add .
|
|
|
|
git diff-index --quiet HEAD || git commit -m ":memo: update api docs"
|
2020-11-26 20:53:28 +08:00
|
|
|
git remote add target https://github.com/$PR_REPO.git
|
2020-11-26 20:18:36 +08:00
|
|
|
git push target HEAD:$REF
|