Enable unicorn/no-null
ESLint rule
#19
Workflow file for this run
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
name: Chromatic Package Size | |
on: | |
pull_request: | |
branches: [main] | |
types: [opened, synchronize] | |
permissions: | |
contents: read | |
issues: write | |
pull-requests: write | |
jobs: | |
chromatic: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: lts/* | |
- run: corepack enable | |
- name: install | |
run: yarn install --immutable | |
- name: build | |
run: yarn build | |
- name: Get Package Size | |
id: package_size | |
run: | | |
export DIST_SIZE="$(du -k ./dist | cut -f1)" | |
echo "Package Size: $DIST_SIZE KB" | |
echo "size=$DIST_SIZE" >> "$GITHUB_OUTPUT" | |
- uses: actions/github-script@v7 | |
with: | |
script: | | |
// 1. Retrieve existing bot comments for the PR | |
const { data: comments } = await github.rest.issues.listComments({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
}) | |
const botComment = comments.find(comment => { | |
return comment.user.type === 'Bot' && comment.body.includes('Package Size') | |
}) | |
const output = "📦 Package Size: ${{ steps.package_size.outputs.size }} KB"; | |
if (botComment) { | |
github.rest.issues.updateComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
comment_id: botComment.id, | |
body: output | |
}) | |
} else { | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: output | |
}) | |
} |