# This workflow runs on target, so there is no need to worry about secrets name: Website Preview Deploy on: workflow_run: workflows: ['Website Preview'] types: [completed] jobs: # Build successfully, start deployment on-success: name: Build successfully runs-on: ubuntu-latest if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - name: Download pr number uses: dawidd6/action-download-artifact@v2 with: workflow: ${{ github.event.workflow.id }} run_id: ${{ github.event.workflow_run.id }} name: pr - name: Output pr number id: pr run: echo "::set-output name=id::$(](https://preview-${{ steps.pr.outputs.id }}-element-plus.surge.sh) body-include: '' number: ${{ steps.pr.outputs.id }} - name: Deploy has failed if: ${{ failure() }} uses: actions-cool/maintain-one-comment@v2.0.2 with: token: ${{ secrets.GITHUB_TOKEN }} body: | [](https://preview-${{ steps.pr.outputs.id }}-element-plus.surge.sh) body-include: '' number: ${{ steps.pr.outputs.id }} # Build failed, update comment on-failure: name: Build failed runs-on: ubuntu-latest if: ${{ github.event.workflow_run.conclusion == 'failure' }} steps: - name: Download pr number uses: dawidd6/action-download-artifact@v2 with: workflow: ${{ github.event.workflow.id }} run_id: ${{ github.event.workflow_run.id }} name: pr - name: Output pr number id: pr run: echo "::set-output name=id::$(](https://preview-${{ steps.pr.outputs.id }}-element-plus.surge.sh) body-include: '' number: ${{ steps.pr.outputs.id }}