Comment on the pull request. #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Comment on the pull request. | |
on: | |
workflow_run: | |
workflows: ["Github Pages"] | |
types: [in_progress, completed] | |
jobs: | |
in-progress: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.status == 'in_progress' }} | |
steps: | |
- name: 'Comment on PR - Waiting for deployment' | |
uses: hasura/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ github.repository }} | |
number: ${{ github.event.workflow_run.pull_requests.number }} | |
id: deploy-preview | |
message: "Starting deployment of preview ⏳..." | |
on-failure: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'failure' }} | |
steps: | |
- name: 'Comment on PR - Waiting for deployment' | |
uses: hasura/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ github.repository }} | |
number: ${{ github.event.workflow_run.pull_requests.number }} | |
id: deploy-preview | |
message: "⚠️⚠️⚠️ Build Failed: No preview available." | |
on-success: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }} | |
env: | |
PR_PATH: dipy.org/pull/${{github.event.workflow_run.pull_requests.number}} | |
BASE_URL: https://dipy.github.io/dipy-preview | |
steps: | |
- name: Update comment | |
uses: hasura/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ github.repository }} | |
number: ${{ github.event.workflow_run.pull_requests.number }} | |
id: deploy-preview | |
message: "A preview of ${{ github.event.workflow_run.head_commit }} is uploaded and can be seen here:\n\n ✨ ${{ env.BASE_URL }}/${{ env.PR_PATH }} ✨\n\nChanges may take a few minutes to propagate. The source is here: https://github.com/${{ github.repository }}/tree/gh-pages/${{ env.PR_PATH }}/" | |