|
39 | 39 | fi |
40 | 40 | echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV |
41 | 41 |
|
| 42 | + - name: Check if deploy token exists |
| 43 | + id: check_token |
| 44 | + run: | |
| 45 | + if [ -z "${{ secrets.DOCS_PREVIEW_DEPLOY_KEY }}" ]; then |
| 46 | + echo "has_token=false" >> $GITHUB_OUTPUT |
| 47 | + echo "⚠️ DOCS_PREVIEW_DEPLOY_KEY secret is not configured" |
| 48 | + else |
| 49 | + echo "has_token=true" >> $GITHUB_OUTPUT |
| 50 | + echo "✅ Deploy token is configured" |
| 51 | + fi |
| 52 | +
|
42 | 53 | - name: Deploy docs preview |
| 54 | + if: steps.check_token.outputs.has_token == 'true' |
43 | 55 | uses: JamesIves/github-pages-deploy-action@v4 |
44 | 56 | with: |
45 | 57 | folder: docs-preview/docs/_build/html |
|
50 | 62 | branch: gh-pages |
51 | 63 |
|
52 | 64 | - uses: actions/github-script@v7 |
| 65 | + if: steps.check_token.outputs.has_token == 'true' |
53 | 66 | env: |
54 | 67 | PR_NUMBER: ${{ env.PR_NUMBER }} |
55 | 68 | with: |
|
81 | 94 | issue_number: issue_number, |
82 | 95 | body: body, |
83 | 96 | }) |
| 97 | +
|
| 98 | + - uses: actions/github-script@v7 |
| 99 | + if: steps.check_token.outputs.has_token == 'false' |
| 100 | + env: |
| 101 | + PR_NUMBER: ${{ env.PR_NUMBER }} |
| 102 | + with: |
| 103 | + script: | |
| 104 | + const issue_number = process.env.PR_NUMBER |
| 105 | + const body = "⚠️ Documentation preview deployment was skipped because the `DOCS_PREVIEW_DEPLOY_KEY` secret is not configured. Please contact a repository administrator to set up the deployment token." |
| 106 | +
|
| 107 | + await github.rest.issues.createComment({ |
| 108 | + owner: context.repo.owner, |
| 109 | + repo: context.repo.repo, |
| 110 | + issue_number: issue_number, |
| 111 | + body: body, |
| 112 | + }) |
0 commit comments