diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 8efb0b0bc..a8c0a062a 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -25,6 +25,42 @@ jobs: uses: styfle/cancel-workflow-action@0.9.1 with: access_token: ${{ github.token }} + - name: Set message value + run: | + echo "comment_message=This pull request is being automatically built with GitHub Action + Netlify. To see the status of your deployment, click below." >> $GITHUB_ENV + - name: Find Comment + if: github.event_name == 'pull_request' + uses: peter-evans/find-comment@v1 + id: fc + with: + issue-number: '${{ github.event.number }}' + comment-author: 'github-actions[bot]' + body-includes: '${{ env.comment_message }}' + - name: Create comment + if: | + github.event_name == 'pull_request' + && steps.fc.outputs.comment-id == '' + uses: peter-evans/create-or-update-comment@v1 + with: + issue-number: ${{ github.event.number }} + body: | + ${{ env.comment_message }} + + 🚧 Deployment in progress for git commit SHA: ${{ github.event.pull_request.head.sha }} + + - name: Update comment + if: | + github.event_name == 'pull_request' + && steps.fc.outputs.comment-id != '' + uses: peter-evans/create-or-update-comment@v1 + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + edit-mode: replace + body: | + ${{ env.comment_message }} + + 🚧 Deployment in progress for git commit SHA: ${{ github.event.pull_request.head.sha }} + - uses: actions/checkout@v2 - uses: conda-incubator/setup-miniconda@master with: diff --git a/.github/workflows/preview-book.yaml b/.github/workflows/preview-book.yaml index 64d6c16b5..f1c20b8e7 100644 --- a/.github/workflows/preview-book.yaml +++ b/.github/workflows/preview-book.yaml @@ -38,8 +38,34 @@ jobs: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} timeout-minutes: 5 - - name: Jupyter Book Preview - uses: ProjectPythia/actions/comment-netlify-preview-in-pr@main + + - name: Set message value + run: | + echo "comment_message=This pull request is being automatically built with GitHub Action + Netlify. To see the status of your deployment, click below." >> $GITHUB_ENV + + - name: Find Pull Request + uses: juliangruber/find-pull-request-action@v1 + id: find-pull-request with: - github-token: ${{ secrets.GITHUB_TOKEN }} - deploy-url: ${{ steps.netlify.outputs.deploy-url }} + branch: ${{ github.event.workflow_run.head_branch }} + + - name: Find Comment + uses: peter-evans/find-comment@v1 + if: steps.find-pull-request.outputs.number != '' + id: fc + with: + issue-number: '${{ steps.find-pull-request.outputs.number }}' + comment-author: 'github-actions[bot]' + body-includes: '${{ env.comment_message }}' + + - name: Update Jupyter Book Preview comment + if: steps.fc.outputs.comment-id != '' + uses: peter-evans/create-or-update-comment@v1 + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + edit-mode: replace + body: | + ${{ env.comment_message }} + + 📚 Git commit SHA: ${{ steps.find-pull-request.outputs.head-sha }} + ✅ Deployment Preview URL: ${{ steps.netlify.outputs.deploy-url }}