Skip to content

Bump tsdown from 0.21.9 to 0.21.10 #79

Bump tsdown from 0.21.9 to 0.21.10

Bump tsdown from 0.21.9 to 0.21.10 #79

Workflow file for this run

name: Performance Notes
on:
pull_request:
push:
branches:
- master
jobs:
perf-check:
if: github.event_name == 'pull_request'
permissions:
contents: read
issues: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v5
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 22.x
cache: 'pnpm'
cache-dependency-path: pnpm-lock.yaml
- run: corepack enable
- run: pnpm install --frozen-lockfile
- name: Fetch master history
run: git fetch origin master:refs/remotes/origin/master
- name: Fetch perf notes
run: |
if git ls-remote --exit-code origin refs/notes/perf >/dev/null 2>&1; then
git fetch origin +refs/notes/perf:refs/notes/perf
fi
- name: Run perf check
shell: bash
run: |
set -o pipefail
pnpm perf:check 2>&1 | tee perf-check.log
- name: Comment on failure
if: failure()
uses: actions/github-script@v8
continue-on-error: true
with:
script: |
const fs = require('node:fs')
const marker = '<!-- react-mentions-ts-perf-check-failure -->'
const output = fs.existsSync('perf-check.log')
? fs.readFileSync('perf-check.log', 'utf8').trim()
: 'The perf-check job failed before perf output was captured.'
const truncatedOutput =
output.length > 6000
? `${output.slice(-6000)}\n\n[output truncated to the last 6000 characters]`
: output
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`
const headSha = context.payload.pull_request?.head.sha
const commitLabel =
typeof headSha === 'string' && headSha.length > 0
? `\`${headSha.slice(0, 7)}\``
: 'this commit'
const body = [
marker,
'### Performance check failed',
'',
`The \`perf-check\` job failed for ${commitLabel}.`,
'',
`[View workflow run](${runUrl})`,
'',
'<details><summary>perf-check output</summary>',
'',
'```text',
truncatedOutput.length > 0 ? truncatedOutput : 'No output was captured.',
'```',
'',
'</details>',
].join('\n')
const { owner, repo } = context.repo
const issue_number = context.issue.number
const comments = await github.paginate(github.rest.issues.listComments, {
owner,
repo,
issue_number,
})
const existingComment = comments.find(
(comment) => comment.user?.type === 'Bot' && comment.body?.includes(marker)
)
if (existingComment) {
await github.rest.issues.updateComment({
owner,
repo,
comment_id: existingComment.id,
body,
})
} else {
await github.rest.issues.createComment({
owner,
repo,
issue_number,
body,
})
}
- name: Clear perf failure comment
if: success()
uses: actions/github-script@v8
continue-on-error: true
with:
script: |
const marker = '<!-- react-mentions-ts-perf-check-failure -->'
const { owner, repo } = context.repo
const issue_number = context.issue.number
const comments = await github.paginate(github.rest.issues.listComments, {
owner,
repo,
issue_number,
})
const existingComment = comments.find(
(comment) => comment.user?.type === 'Bot' && comment.body?.includes(marker)
)
if (existingComment) {
await github.rest.issues.deleteComment({
owner,
repo,
comment_id: existingComment.id,
})
}
perf-record:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v5
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 22.x
cache: 'pnpm'
cache-dependency-path: pnpm-lock.yaml
- run: corepack enable
- run: pnpm install --frozen-lockfile
- name: Fetch perf notes
run: |
if git ls-remote --exit-code origin refs/notes/perf >/dev/null 2>&1; then
git fetch origin +refs/notes/perf:refs/notes/perf
fi
- name: Configure git identity
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- run: pnpm perf:record
- name: Push perf notes
run: git push origin refs/notes/perf:refs/notes/perf