Skip to content

Commit

Permalink
chore(workflow): update action
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverschuerch committed May 2, 2024
1 parent d6816ec commit ab3b604
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 34 deletions.
31 changes: 0 additions & 31 deletions .github/actions/preview-message-creation/action.yaml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/actions/preview/message/creation/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Preview message creation
description: Append a preview url message in the pr body, if not already present

inputs:
access-token:
description: The access_token to use for commenting.
required: true

runs:
using: composite
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ inputs.access-token }}
script: |
const credentials = {
repo: context.repo.repo,
owner: context.repo.owner,
issue_number: context.issue.number
}
const comments = (await github.rest.issues.listComments({ ...credentials })).data || []
const hasPreviewComment = comments.some(c => c.user.login === 'swisspost-bot' && c.body.includes('**Related Previews**\n'))
if (!hasPreviewComment) {
github.rest.issues.createComment({
...credentials,
body: '**Related Previews**\n Preview URLs will be added here, once they are ready... ![loader](https://github.com/swisspost/design-system/assets/9716662/49a75898-7093-4ffb-9460-071ff194459d)'
})
}
8 changes: 5 additions & 3 deletions .github/workflows/build-documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Provide preview message
uses: swisspost/design-system/.github/actions/preview-message-creation

- name: Checkout
uses: actions/checkout@v4

- name: Provide preview message
uses: ./.github/actions/preview/message/creation
with:
access-token: ${{ secrets.SWISSPOSTDEVS_ACCESS_TOKEN }}

- name: Setup
uses: swisspost/design-system/.github/actions/setup-pnpm@main

Expand Down

0 comments on commit ab3b604

Please sign in to comment.