diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 000000000..6f74848a1 --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,116 @@ +name: Previte + +on: + workflow_call: + push: + branches: + - dev + - next + - main + - en + pull_request: + workflow_dispatch: + +jobs: + preview-success: + runs-on: ubuntu-latest + if: > + github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.conclusion == 'success' + steps: + - name: download pr artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: ${{ github.event.workflow_run.workflow_id }} + run_id: ${{ github.event.workflow_run.id }} + name: pr + - name: save PR id + id: pr + run: echo "::set-output name=id::$(Kongying Tavern PR Preview + + + number: ${{ steps.pr.outputs.id }} + body-include: "" + + - run: | + rm -rf .vitepress/dist + + - name: The job failed + if: ${{ failure() }} + uses: actions-cool/maintain-one-comment@v2.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + body: | + [失败](${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}) + + number: ${{ steps.pr.outputs.id }} + body-include: "" + + preview-failed: + runs-on: ubuntu-latest + if: > + github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.conclusion == 'failure' + steps: + - name: download pr artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: ${{ github.event.workflow_run.workflow_id }} + run_id: ${{ github.event.workflow_run.id }} + name: pr + - name: save PR id + id: pr + run: echo "::set-output name=id::$( + number: ${{ steps.pr.outputs.id }} + body-include: "" \ No newline at end of file