Skip to content

Commit 7cebc86

Browse files
authored
Use managed GitHub token for draft dispatch and bundle preview (#181)
* Dispatch draft deploys using managed GitHub token * Use managed GitHub token for bundle preview deploy comments
1 parent 977b474 commit 7cebc86

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

.github/workflows/deploy-bundle-preview.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
if: ${{ success() && github.event.pull_request.number }}
5757
uses: peter-evans/create-or-update-comment@v3
5858
with:
59-
token: ${{ secrets.COMMENT_GITHUB_TOKEN }}
59+
token: ${{ secrets.DOCS_GITHUB_PAT }}
6060
issue-number: ${{ github.event.pull_request.number }}
6161
body: |
6262
UI bundle preview build successful! :white_check_mark:
@@ -67,7 +67,7 @@ jobs:
6767
if: ${{ failure() && github.event.pull_request.number }}
6868
uses: peter-evans/create-or-update-comment@v3
6969
with:
70-
token: ${{ secrets.COMMENT_GITHUB_TOKEN }}
70+
token: ${{ secrets.DOCS_GITHUB_PAT }}
7171
issue-number: ${{ github.event.pull_request.number }}
7272
body: |
7373
UI bundle preview build failure! :x:
@@ -79,9 +79,8 @@ jobs:
7979
uses: peter-evans/find-comment@v2
8080
id: fc
8181
with:
82-
token: ${{ secrets.COMMENT_GITHUB_TOKEN }}
82+
token: ${{ secrets.DOCS_GITHUB_PAT }}
8383
issue-number: ${{ github.event.pull_request.number }}
84-
comment-author: 'mlr'
8584
body-includes: UI bundle preview build successful!
8685
direction: last
8786

@@ -116,7 +115,7 @@ jobs:
116115
sleep 5 # Allow time for build to initiate
117116
build_url=$(curl -s -L \
118117
-H "Accept: application/vnd.github+json" \
119-
-H "Authorization: Bearer ${{ secrets.COMMENT_GITHUB_TOKEN }}" \
118+
-H "Authorization: Bearer ${{ secrets.DOCS_GITHUB_PAT }}" \
120119
-H "X-GitHub-Api-Version: 2022-11-28" 'https://api.github.com/repos/${{ github.event.repository.full_name }}/pages/builds/latest' \
121120
| jq -r .url)
122121
echo "url=$build_url" >> $GITHUB_OUTPUT
@@ -128,7 +127,7 @@ jobs:
128127
for i in {1..60}; do
129128
build_status=$(curl -s -L \
130129
-H "Accept: application/vnd.github+json" \
131-
-H "Authorization: Bearer ${{ secrets.COMMENT_GITHUB_TOKEN }}" \
130+
-H "Authorization: Bearer ${{ secrets.DOCS_GITHUB_PAT }}" \
132131
-H "X-GitHub-Api-Version: 2022-11-28" '${{ steps.ghpages_build.outputs.url }}' \
133132
| jq -r .status)
134133
@@ -153,7 +152,7 @@ jobs:
153152
if: ${{ steps.fc.outputs.comment-id != '' }}
154153
uses: peter-evans/create-or-update-comment@v3
155154
with:
156-
token: ${{ secrets.COMMENT_GITHUB_TOKEN }}
155+
token: ${{ secrets.DOCS_GITHUB_PAT }}
157156
comment-id: ${{ steps.fc.outputs.comment-id }}
158157
body: |
159158
Deployment successful! [View preview](${{ steps.draft_url.outputs.url }})

.github/workflows/dispatch-deploy-draft.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ jobs:
1515
with:
1616
owner: riptano
1717
repo: datastax-docs-site
18-
github_token: ${{ secrets.DISPATCH_GITHUB_TOKEN }}
19-
github_user: mlr
18+
github_token: ${{ secrets.DOCS_GITHUB_PAT }}
2019
workflow_file_name: deploy-draft.yml
2120
client_payload: '{ "build_repository": "${{ github.event.repository.full_name }}", "build_branch": "main", "draft_branch": "${{ github.event.pull_request.head.ref }}", "pull_request_number": "${{ github.event.pull_request.number }}", "ui_bundle_repository": "${{ github.event.repository.full_name }}", "ui_bundle_branch": "${{ github.event.pull_request.head.ref }}" }'

0 commit comments

Comments
 (0)