Skip to content

Commit

Permalink
fix: preview message update script
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverschuerch committed Jan 21, 2025
1 parent 4ac9108 commit 67f55b6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 23 deletions.
21 changes: 11 additions & 10 deletions .github/actions/preview/message/update/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,32 @@ runs:
})).data || []
const previewComment = comments.find(c => c.user.login === 'swisspost-bot' && c.body.includes(commentTitle))
const iconsUpdateTitle = 'chore(icons): :point_up: update icons'
if (previewComment && !previewComment.body.includes(PREVIEW_URL)) {
let updatedBody = previewComment.body
.replace(commentInitialBody, '')
.concat(`- ${PREVIEW_URL}\n`);
let updates = [];
const issueTitle = await github.rest.issues.get({
const issue = await github.rest.issues.get({
repo: context.repo.repo,
owner: context.repo.owner,
issue_number: Number(ISSUE_NUMBER),
}).data.title;
});
// If issue is an update icons PR, include an icons health page link
if (issueTitle.includes('chore(icons): :point_up: update icons')) {
updatedBody = updatedBody.concat(`- ${PREVIEW_URL}?path=/docs/health-icons--docs\n`)
if (issue?.data?.title.includes(iconsUpdateTitle)) {
updates.push(`- ${PREVIEW_URL}?path=/docs/health-icons--docs\n`)
}
await github.rest.issues.updateComment({
repo: context.repo.repo,
owner: context.repo.owner,
comment_id: previewComment.id,
body: updatedBody
body: previewComment.body
.replace(commentInitialBody, '')
.concat(`- ${PREVIEW_URL}\n`)
.concat(updates.join(''))
});
const reactions = (await github.rest.reactions.({
const reactions = (await github.rest.reactions.listForIssueComment({
repo: context.repo.repo,
owner: context.repo.owner,
comment_id: previewComment.id,
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/build-documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,6 @@ jobs:
- name: Install documentation & dependencies
run: pnpm --filter design-system-documentation... install

- name: Create preview message
uses: ./.github/actions/preview/message/create
with:
access-token: ${{ secrets.SWISSPOSTDEVS_ACCESS_TOKEN }}
issue-number: ${{ github.event.number }}

- name: Update preview message
uses: ./.github/actions/preview/message/update
with:
access-token: ${{ secrets.SWISSPOSTDEVS_ACCESS_TOKEN }}
issue-number: ${{ github.event.number }}
preview-url: https://preview-4453--swisspost-design-system-next.netlify.app

- name: Build documentation & dependencies
run: pnpm --filter design-system-documentation... build

Expand Down

0 comments on commit 67f55b6

Please sign in to comment.