|
10 | 10 | concurrency: |
11 | 11 | group: docs |
12 | 12 |
|
| 13 | +permissions: |
| 14 | + contents: write |
| 15 | + pull-requests: write |
| 16 | + |
13 | 17 | jobs: |
14 | 18 | build-and-preview: |
15 | 19 | if: github.event.action == 'opened' || github.event.action == 'synchronize' |
@@ -70,41 +74,11 @@ jobs: |
70 | 74 | commit-message: Deploy preview for PR ${{ github.event.pull_request.number }} |
71 | 75 | token: ${{ secrets.GITHUB_TOKEN }} |
72 | 76 |
|
73 | | - comment-preview-url: |
74 | | - needs: build-and-preview |
75 | | - if: needs.build-and-preview.result == 'success' |
76 | | - runs-on: ubuntu-latest |
77 | | - steps: |
78 | | - - name: Comment Preview URL |
| 77 | + - name: Comment preview URL |
79 | 78 | uses: thollander/actions-comment-pull-request@v2 |
80 | 79 | with: |
81 | 80 | message: | |
82 | 81 | <!-- preview-url-comment --> |
83 | 82 | Preview the changes: https://turinglang.org/docs/pr-previews/${{ github.event.pull_request.number }} |
84 | 83 | Please avoid using the search feature and navigation bar in PR previews! |
85 | 84 | comment_tag: preview-url-comment |
86 | | - env: |
87 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
88 | | - |
89 | | - delete-preview-directory: |
90 | | - if: github.event.action == 'closed' || github.event.pull_request.merged == true |
91 | | - runs-on: ubuntu-latest |
92 | | - steps: |
93 | | - - name: Checkout gh-pages branch |
94 | | - uses: actions/checkout@v4 |
95 | | - with: |
96 | | - ref: gh-pages |
97 | | - |
98 | | - - name: Remove PR Preview Directory |
99 | | - run: | |
100 | | - PR_NUMBER=${{ github.event.pull_request.number }} |
101 | | - PREVIEW_DIR="pr-previews/${PR_NUMBER}" |
102 | | - git config --global user.name "github-actions[bot]" |
103 | | - git config --global user.email "github-actions[bot]@users.noreply.github.com" |
104 | | - git pull origin gh-pages |
105 | | - rm -rf ${PREVIEW_DIR} |
106 | | - git add . |
107 | | - git commit -m "Remove preview for merged PR #${PR_NUMBER}" |
108 | | - git push |
109 | | - env: |
110 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments