feat(ui): adds repo-based collapsible grouping to Issues and PRs tabs #11
Workflow file for this run
This file contains hidden or 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: Preview | |
| on: | |
| pull_request: | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| ci: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm run typecheck | |
| - run: pnpm test | |
| - name: Verify CSP hash | |
| run: node scripts/verify-csp-hash.mjs | |
| - name: Install Playwright browsers | |
| run: npx playwright install chromium --with-deps | |
| - name: Run E2E tests | |
| run: pnpm test:e2e | |
| env: | |
| VITE_GITHUB_CLIENT_ID: ${{ vars.VITE_GITHUB_CLIENT_ID }} | |
| preview: | |
| needs: ci | |
| if: github.event.pull_request.head.repo.full_name == github.repository | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - name: Verify CSP hash | |
| run: node scripts/verify-csp-hash.mjs | |
| - run: pnpm run build | |
| env: | |
| VITE_GITHUB_CLIENT_ID: ${{ vars.VITE_GITHUB_CLIENT_ID }} | |
| - name: Slugify branch name | |
| id: slug | |
| env: | |
| BRANCH: ${{ github.head_ref }} | |
| run: echo "alias=$(echo "$BRANCH" | sed 's/[^a-zA-Z0-9]/-/g; s/--*/-/g; s/^-//; s/-$//' | tr 'A-Z' 'a-z' | sed 's/^[^a-z]*//' | cut -c1-48 | sed 's/-$//; s/^$/preview/')" >> "$GITHUB_OUTPUT" | |
| - name: Upload preview version | |
| id: preview | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: versions upload --preview-alias ${{ steps.slug.outputs.alias }} | |
| - name: Comment preview URL | |
| uses: actions/github-script@v7 | |
| env: | |
| WRANGLER_OUTPUT: ${{ steps.preview.outputs.command-output }} | |
| BRANCH_ALIAS: ${{ steps.slug.outputs.alias }} | |
| BRANCH_NAME: ${{ github.head_ref }} | |
| with: | |
| script: | | |
| const output = process.env.WRANGLER_OUTPUT || ''; | |
| const urlMatch = output.match(/https:\/\/[^\s"'`]+\.workers\.dev[^\s"'`]*/); | |
| const alias = process.env.BRANCH_ALIAS; | |
| const branch = process.env.BRANCH_NAME; | |
| const url = urlMatch ? urlMatch[0] : `Preview alias: ${alias} (check workflow logs for URL)`; | |
| const marker = '<!-- cf-preview -->'; | |
| const body = [ | |
| '### Preview Deployment', | |
| '', | |
| urlMatch ? `[${url}](${url})` : url, | |
| '', | |
| `Branch: \`${branch}\` | Alias: \`${alias}\``, | |
| '', | |
| marker, | |
| ].join('\n'); | |
| const comments = await github.paginate(github.rest.issues.listComments, { | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const existing = comments.find(c => c.body?.includes(marker)); | |
| 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: context.issue.number, | |
| body, | |
| }); | |
| } |