From 61446e1a5abc590152b41760ddd419cc056ad803 Mon Sep 17 00:00:00 2001 From: Ronnie Miller Date: Tue, 28 Jan 2025 13:46:58 -0800 Subject: [PATCH 1/3] Dispatch draft deploys using managed GitHub token --- .github/workflows/dispatch-deploy-draft.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/dispatch-deploy-draft.yml b/.github/workflows/dispatch-deploy-draft.yml index 2aaf7b07..a5f65bdc 100644 --- a/.github/workflows/dispatch-deploy-draft.yml +++ b/.github/workflows/dispatch-deploy-draft.yml @@ -15,7 +15,6 @@ jobs: with: owner: riptano repo: datastax-docs-site - github_token: ${{ secrets.DISPATCH_GITHUB_TOKEN }} - github_user: mlr + github_token: ${{ secrets.DOCS_GITHUB_PAT }} workflow_file_name: deploy-draft.yml 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 }}" }' From fb1b81a0604fa1dac97974c78384f61d02453998 Mon Sep 17 00:00:00 2001 From: Ronnie Miller Date: Tue, 28 Jan 2025 13:47:36 -0800 Subject: [PATCH 2/3] Use managed GitHub token for bundle preview deploy comments --- .github/workflows/deploy-bundle-preview.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy-bundle-preview.yml b/.github/workflows/deploy-bundle-preview.yml index 1381194a..de02938a 100644 --- a/.github/workflows/deploy-bundle-preview.yml +++ b/.github/workflows/deploy-bundle-preview.yml @@ -56,7 +56,7 @@ jobs: if: ${{ success() && github.event.pull_request.number }} uses: peter-evans/create-or-update-comment@v3 with: - token: ${{ secrets.COMMENT_GITHUB_TOKEN }} + token: ${{ secrets.DOCS_GITHUB_PAT }} issue-number: ${{ github.event.pull_request.number }} body: | UI bundle preview build successful! :white_check_mark: @@ -67,7 +67,7 @@ jobs: if: ${{ failure() && github.event.pull_request.number }} uses: peter-evans/create-or-update-comment@v3 with: - token: ${{ secrets.COMMENT_GITHUB_TOKEN }} + token: ${{ secrets.DOCS_GITHUB_PAT }} issue-number: ${{ github.event.pull_request.number }} body: | UI bundle preview build failure! :x: @@ -79,7 +79,7 @@ jobs: uses: peter-evans/find-comment@v2 id: fc with: - token: ${{ secrets.COMMENT_GITHUB_TOKEN }} + token: ${{ secrets.DOCS_GITHUB_PAT }} issue-number: ${{ github.event.pull_request.number }} comment-author: 'mlr' body-includes: UI bundle preview build successful! @@ -116,7 +116,7 @@ jobs: sleep 5 # Allow time for build to initiate build_url=$(curl -s -L \ -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.COMMENT_GITHUB_TOKEN }}" \ + -H "Authorization: Bearer ${{ secrets.DOCS_GITHUB_PAT }}" \ -H "X-GitHub-Api-Version: 2022-11-28" 'https://api.github.com/repos/${{ github.event.repository.full_name }}/pages/builds/latest' \ | jq -r .url) echo "url=$build_url" >> $GITHUB_OUTPUT @@ -128,7 +128,7 @@ jobs: for i in {1..60}; do build_status=$(curl -s -L \ -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.COMMENT_GITHUB_TOKEN }}" \ + -H "Authorization: Bearer ${{ secrets.DOCS_GITHUB_PAT }}" \ -H "X-GitHub-Api-Version: 2022-11-28" '${{ steps.ghpages_build.outputs.url }}' \ | jq -r .status) @@ -153,7 +153,7 @@ jobs: if: ${{ steps.fc.outputs.comment-id != '' }} uses: peter-evans/create-or-update-comment@v3 with: - token: ${{ secrets.COMMENT_GITHUB_TOKEN }} + token: ${{ secrets.DOCS_GITHUB_PAT }} comment-id: ${{ steps.fc.outputs.comment-id }} body: | Deployment successful! [View preview](${{ steps.draft_url.outputs.url }}) From cd2063432ea9087c96b3223f7f4334a8c6c7bbbc Mon Sep 17 00:00:00 2001 From: Ronnie Miller Date: Tue, 28 Jan 2025 13:55:20 -0800 Subject: [PATCH 3/3] Remove author when updating pull request with GitHub Pages build status --- .github/workflows/deploy-bundle-preview.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/deploy-bundle-preview.yml b/.github/workflows/deploy-bundle-preview.yml index de02938a..7c6d09d6 100644 --- a/.github/workflows/deploy-bundle-preview.yml +++ b/.github/workflows/deploy-bundle-preview.yml @@ -81,7 +81,6 @@ jobs: with: token: ${{ secrets.DOCS_GITHUB_PAT }} issue-number: ${{ github.event.pull_request.number }} - comment-author: 'mlr' body-includes: UI bundle preview build successful! direction: last