-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Oliver Schürch <[email protected]>
- Loading branch information
1 parent
9b36cdc
commit b3e9ac2
Showing
22 changed files
with
733 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,15 @@ | |
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": [ | ||
"../packages/changelog-github/dist/index.js", | ||
{ "repo": "swisspost/design-system" } | ||
{ | ||
"repo": "swisspost/design-system" | ||
} | ||
], | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "restricted", | ||
"baseBranch": "main", | ||
"baseBranch": "release/v6", | ||
"updateInternalDependencies": "patch", | ||
"ignore": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@swisspost/design-system-documentation': patch | ||
--- | ||
|
||
Updated netlify site configuration for v6 docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Create preview message | ||
description: Add a preview comment to the pr, 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 commentTitle = '**Related Previews**' | ||
const commentInitialBody = 'Preview URLs will be added here, once they are ready... ![loader](https://github.com/swisspost/design-system/assets/9716662/49a75898-7093-4ffb-9460-071ff194459d)' | ||
let comments | ||
let previewComment | ||
await getPreviewComment() | ||
if (!previewComment) { | ||
await github.rest.issues.createComment({ | ||
repo: context.repo.repo, | ||
owner: context.repo.owner, | ||
issue_number: context.issue.number, | ||
body: `${commentTitle}\n${commentInitialBody}` | ||
}) | ||
await getPreviewComment() | ||
github.rest.reactions.createForIssueComment({ | ||
repo: context.repo.repo, | ||
owner: context.repo.owner, | ||
comment_id: previewComment.id, | ||
content: 'eyes' | ||
}) | ||
} else { | ||
console.info('Skipped action, because preview comment already existed.') | ||
} | ||
async function getPreviewComment () { | ||
comments = (await github.rest.issues.listComments({ | ||
repo: context.repo.repo, | ||
owner: context.repo.owner, | ||
issue_number: context.issue.number | ||
})).data || [] | ||
previewComment = comments.find(c => c.user.login === 'swisspost-bot' && c.body.includes(commentTitle)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Update preview message | ||
description: Add a preview url to the existing preview comment, if not already present | ||
|
||
inputs: | ||
access-token: | ||
description: The access token to use for commenting. | ||
required: true | ||
issue-number: | ||
description: The issue number from the caller workflow. | ||
required: true | ||
preview-url: | ||
description: The preview url to add in the comment. | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: actions/github-script@v7 | ||
env: | ||
ISSUE_NUMBER: ${{ inputs.issue-number }} | ||
PREVIEW_URL: ${{ inputs.preview-url }} | ||
with: | ||
github-token: ${{ inputs.access-token }} | ||
script: | | ||
const { ISSUE_NUMBER, PREVIEW_URL } = process.env | ||
const commentTitle = '**Related Previews**' | ||
const commentInitialBody = 'Preview URLs will be added here, once they are ready... ![loader](https://github.com/swisspost/design-system/assets/9716662/49a75898-7093-4ffb-9460-071ff194459d)' | ||
const comments = (await github.rest.issues.listComments({ | ||
repo: context.repo.repo, | ||
owner: context.repo.owner, | ||
issue_number: Number(ISSUE_NUMBER) | ||
})).data || [] | ||
const previewComment = comments.find(c => c.user.login === 'swisspost-bot' && c.body.includes(commentTitle)) | ||
if (previewComment && !previewComment.body.includes(PREVIEW_URL)) { | ||
github.rest.issues.updateComment({ | ||
repo: context.repo.repo, | ||
owner: context.repo.owner, | ||
comment_id: previewComment.id, | ||
body: previewComment.body | ||
.replace(commentInitialBody, '') | ||
.concat(`- ${PREVIEW_URL}\n`) | ||
}) | ||
const reactions = (await github.rest.reactions.listForIssueComment({ | ||
repo: context.repo.repo, | ||
owner: context.repo.owner, | ||
comment_id: previewComment.id, | ||
})).data || [] | ||
const createReaction = reactions.find(r => r.user.login === 'swisspost-bot' && r.content === 'eyes') | ||
const updateReaction = reactions.find(r => r.user.login === 'swisspost-bot' && r.content === 'rocket') | ||
if (createReaction) { | ||
github.rest.reactions.deleteForIssueComment({ | ||
repo: context.repo.repo, | ||
owner: context.repo.owner, | ||
comment_id: previewComment.id, | ||
reaction_id: createReaction.id | ||
}) | ||
} | ||
if (!updateReaction) { | ||
github.rest.reactions.createForIssueComment({ | ||
repo: context.repo.repo, | ||
owner: context.repo.owner, | ||
comment_id: previewComment.id, | ||
content: 'rocket' | ||
}) | ||
} | ||
} else { | ||
console.warn('Skipped action, because preview comment could not be found!') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
### | ||
# | ||
# NOTE: We've created this action to ensure, we are using the same Netlify-CLI version everywhere | ||
# | ||
### | ||
|
||
name: Setup Netlify CLI | ||
description: Provides node and pnpm in a specific version. | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Install netlify-cli | ||
shell: bash | ||
run: pnpm i -g netlify-cli@17 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.