Skip to content

perf(tests): speed up E2E test suite #128

perf(tests): speed up E2E test suite

perf(tests): speed up E2E test suite #128

Workflow file for this run

name: PR Preview
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: write
pull-requests: write
jobs:
preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/setup
- name: Build all generated files
run: npm run build
- name: Deploy PR preview to gh-pages branch
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .
destination_dir: previews/pr-${{ github.event.number }}
# Preserve existing previews and production files
keep_files: true
# Exclude non-site files (keep in sync with deploy.yml)
exclude_assets: '.github,node_modules,tests,scripts,package-lock.json,package.json,milestones.yaml,project-stats.yaml'
- name: Post or update preview URL comment
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const prNumber = context.payload.pull_request.number;
const sha = context.payload.pull_request.head.sha.slice(0, 7);
const url = `https://nitrocode.github.io/token-deathclock/previews/pr-${prNumber}/`;
const body = [
'## 👁️ PR Preview',
'',
`🚀 **[Open Preview](${url})**`,
'',
`> Deployed from commit \`${sha}\` · Updates on every push to this PR`,
'> _(Preview is removed automatically when the PR is closed.)_',
].join('\n');
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
});
const existing = comments.find(c =>
c.user.type === 'Bot' && c.body.includes('## 👁️ PR Preview')
);
if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body,
});
}