|
8 | 8 | jobs: |
9 | 9 | build: |
10 | 10 | name: Build |
| 11 | + permissions: |
| 12 | + pull-requests: write |
11 | 13 | runs-on: ubuntu-22.04 |
12 | 14 | steps: |
| 15 | + - name: Find Comment |
| 16 | + uses: peter-evans/find-comment@v2 |
| 17 | + id: fc |
| 18 | + with: |
| 19 | + issue-number: ${{ github.event.pull_request.number }} |
| 20 | + comment-author: 'github-actions[bot]' |
| 21 | + body-includes: to Netlify |
| 22 | + |
| 23 | + - name: Create or update comment |
| 24 | + uses: peter-evans/create-or-update-comment@v3 |
| 25 | + with: |
| 26 | + comment-id: ${{ steps.fc.outputs.comment-id }} |
| 27 | + issue-number: ${{ github.event.pull_request.number }} |
| 28 | + body: | |
| 29 | + ## 🚧 Deploying to Netlify |
| 30 | +
|
| 31 | + | Status | URL | |
| 32 | + |-------------|--------------------------------------| |
| 33 | + | Pending | `URL will be revealed once deployed` | |
| 34 | + edit-mode: replace |
| 35 | + |
13 | 36 | - name: Checkout |
14 | 37 | uses: actions/checkout@v3 |
15 | 38 | with: |
@@ -51,10 +74,25 @@ jobs: |
51 | 74 | run: pnpm install -g netlify-cli |
52 | 75 |
|
53 | 76 | - name: Push to Netlify |
| 77 | + id: netlify |
54 | 78 | timeout-minutes: 10 |
55 | 79 | working-directory: docs/ |
56 | | - run: netlify deploy --dir .vitepress/dist |
| 80 | + run: | |
| 81 | + echo "NETLIFY_URL=$(netlify deploy --dir .vitepress/dist --json | jq -r .deploy_url)" >> $GITHUB_ENV |
| 82 | + cat $GITHUB_ENV |
57 | 83 | env: |
58 | 84 | NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
59 | 85 | NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |
60 | 86 |
|
| 87 | + - name: Create or update comment |
| 88 | + uses: peter-evans/create-or-update-comment@v3 |
| 89 | + with: |
| 90 | + comment-id: ${{ steps.fc.outputs.comment-id }} |
| 91 | + issue-number: ${{ github.event.pull_request.number }} |
| 92 | + body: | |
| 93 | + ## ✅ Deployed to Netlify |
| 94 | +
|
| 95 | + | Status | URL | |
| 96 | + |-------------|-----------------------------------------------------| |
| 97 | + | Success | ${{ env.NETLIFY_URL }} | |
| 98 | + edit-mode: replace |
0 commit comments