|
6 | 6 | - "release/v*"
|
7 | 7 | paths-ignore:
|
8 | 8 | - "**/*.png"
|
9 |
| - pull_request: |
10 |
| - branches: |
11 |
| - - "main" |
12 |
| - - "release/v*" |
13 |
| - paths-ignore: |
14 |
| - - "**/*.png" |
| 9 | + pull_request_target: |
| 10 | + types: [opened, synchronize, reopened] |
15 | 11 |
|
16 | 12 | jobs:
|
17 | 13 | docs-lint:
|
18 | 14 | runs-on: ubuntu-22.04
|
19 | 15 | steps:
|
20 | 16 | - name: Check out code
|
21 | 17 | uses: actions/checkout@v4
|
| 18 | + with: |
| 19 | + ref: ${{ github.event.pull_request.head.sha }} |
22 | 20 |
|
23 | 21 | - name: Run markdown linter
|
24 | 22 |
|
|
36 | 34 | uses: actions/checkout@v4
|
37 | 35 | with:
|
38 | 36 | submodules: true
|
| 37 | + ref: ${{ github.event.pull_request.head.sha }} |
39 | 38 |
|
40 | 39 | - name: Setup Hugo
|
41 | 40 | uses: peaceiris/actions-hugo@v2
|
|
60 | 59 | # Duration after which artifact will expire in days.
|
61 | 60 | # retention-days: # optional, default is 1
|
62 | 61 |
|
| 62 | + docs-preview: |
| 63 | + if: "github.event_name == 'pull_request_target'" |
| 64 | + needs: docs-build |
| 65 | + runs-on: ubuntu-22.04 |
| 66 | + steps: |
| 67 | + - name: Git checkout |
| 68 | + uses: actions/checkout@v4 |
| 69 | + with: |
| 70 | + ref: ${{ github.event.pull_request.head.sha }} |
| 71 | + - name: Setup Hugo |
| 72 | + uses: peaceiris/actions-hugo@v2 |
| 73 | + with: |
| 74 | + hugo-version: 'latest' |
| 75 | + extended: true |
| 76 | + - name: Setup Node |
| 77 | + uses: actions/setup-node@v4 |
| 78 | + with: |
| 79 | + node-version: '18' |
| 80 | + - name: Install Site Dependencies and Build Site |
| 81 | + run: make docs |
| 82 | + - name: Deploy to Netlify |
| 83 | + |
| 84 | + with: |
| 85 | + publish-dir: 'site/public' |
| 86 | + production-deploy: false |
| 87 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 88 | + deploy-message: "Deploy from GitHub Actions" |
| 89 | + alias: "${{ github.event.repository.name }}-pr-${{ github.event.pull_request.number }}-preview" |
| 90 | + # these all default to 'true' |
| 91 | + enable-pull-request-comment: true |
| 92 | + enable-commit-comment: false |
| 93 | + enable-commit-status: true |
| 94 | + overwrites-pull-request-comment: true |
| 95 | + env: |
| 96 | + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
| 97 | + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |
| 98 | + timeout-minutes: 1 |
| 99 | + |
63 | 100 | # This workflow contains a single job called "build"
|
64 | 101 | docs-publish:
|
65 | 102 | if: github.event_name == 'push'
|
|
0 commit comments