Skip to content

Commit 18aa581

Browse files
committed
Use managed PAT for bundle preview and release builds [no-release]
1 parent ed28d4e commit 18aa581

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Configure Git Credentials
1717
uses: de-vri-es/setup-git-credentials@v2
1818
with:
19-
credentials: ${{ secrets.GIT_CREDENTIALS }}
19+
credentials: https://${{ secrets.DOCS_GITHUB_PAT }}@github.com
2020

2121
- name: Checkout Repository
2222
uses: actions/checkout@v4
@@ -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,15 +79,17 @@ 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

8887
- name: Deploy to GitHub Pages
8988
if: success()
9089
run: |
90+
# Configure git to use the PAT for cloning and pushing to the gh-pages branch
91+
git config --global url.https://${{ secrets.DOCS_GITHUB_PAT }}@github.com/.insteadOf https://github.com/
92+
9193
git clone https://github.com/$GITHUB_REPOSITORY.git pages
9294
cd pages
9395
git checkout gh-pages
@@ -116,7 +118,7 @@ jobs:
116118
sleep 5 # Allow time for build to initiate
117119
build_url=$(curl -s -L \
118120
-H "Accept: application/vnd.github+json" \
119-
-H "Authorization: Bearer ${{ secrets.COMMENT_GITHUB_TOKEN }}" \
121+
-H "Authorization: Bearer ${{ secrets.DOCS_GITHUB_PAT }}" \
120122
-H "X-GitHub-Api-Version: 2022-11-28" 'https://api.github.com/repos/${{ github.event.repository.full_name }}/pages/builds/latest' \
121123
| jq -r .url)
122124
echo "url=$build_url" >> $GITHUB_OUTPUT
@@ -128,7 +130,7 @@ jobs:
128130
for i in {1..60}; do
129131
build_status=$(curl -s -L \
130132
-H "Accept: application/vnd.github+json" \
131-
-H "Authorization: Bearer ${{ secrets.COMMENT_GITHUB_TOKEN }}" \
133+
-H "Authorization: Bearer ${{ secrets.DOCS_GITHUB_PAT }}" \
132134
-H "X-GitHub-Api-Version: 2022-11-28" '${{ steps.ghpages_build.outputs.url }}' \
133135
| jq -r .status)
134136
@@ -153,7 +155,7 @@ jobs:
153155
if: ${{ steps.fc.outputs.comment-id != '' }}
154156
uses: peter-evans/create-or-update-comment@v3
155157
with:
156-
token: ${{ secrets.COMMENT_GITHUB_TOKEN }}
158+
token: ${{ secrets.DOCS_GITHUB_PAT }}
157159
comment-id: ${{ steps.fc.outputs.comment-id }}
158160
body: |
159161
Deployment successful! [View preview](${{ steps.draft_url.outputs.url }})

.github/workflows/release-ui-bundle.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Configure Git Credentials
1717
uses: de-vri-es/setup-git-credentials@v2
1818
with:
19-
credentials: ${{ secrets.GIT_CREDENTIALS }}
19+
credentials: https://${{ secrets.DOCS_GITHUB_PAT }}@github.com
2020

2121
- name: Checkout Repository
2222
uses: actions/checkout@v4
@@ -25,8 +25,6 @@ jobs:
2525

2626
- name: Check Last Commit Message
2727
id: skip_release
28-
env:
29-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3028
run: |
3129
last_commit_message=$(git log -1 --pretty=%B)
3230
if [[ $last_commit_message == *"[no-release]"* ]]; then

0 commit comments

Comments
 (0)