Skip to content

Conversation

@pranaygp
Copy link
Collaborator

@pranaygp pranaygp commented Nov 13, 2025

Add new /run-ci command to allow repo admins to trigger a CI run for external collaborator PRs

Leaving in draft just so we remove the claude generated md files before actually merging :)

@pranaygp pranaygp requested a review from TooTallNate November 13, 2025 02:32
@changeset-bot
Copy link

changeset-bot bot commented Nov 13, 2025

⚠️ No Changeset found

Latest commit: 8e0fe49

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Contributor

vercel bot commented Nov 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview Comment Dec 2, 2025 6:48pm
example-nextjs-workflow-webpack Ready Ready Preview Comment Dec 2, 2025 6:48pm
example-workflow Ready Ready Preview Comment Dec 2, 2025 6:48pm
workbench-astro-workflow Error Error Dec 2, 2025 6:48pm
workbench-express-workflow Error Error Dec 2, 2025 6:48pm
workbench-hono-workflow Ready Ready Preview Comment Dec 2, 2025 6:48pm
workbench-nitro-workflow Ready Ready Preview Comment Dec 2, 2025 6:48pm
workbench-nuxt-workflow Ready Ready Preview Comment Dec 2, 2025 6:48pm
workbench-sveltekit-workflow Ready Ready Preview Comment Dec 2, 2025 6:48pm
workbench-vite-workflow Ready Ready Preview Comment Dec 2, 2025 6:48pm
workflow-docs Ready Ready Preview Comment Dec 2, 2025 6:48pm

github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer we pull these out into script files, like here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot please do this

with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.rest.issues.createComment({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure we need to post a comment on the PR. Maybe just no-op.

const timestamp = new Date().getTime();
const ciBranchName = `ci-test/${prDetails.number}-${timestamp}`;

// Add remote for the external fork if it's from a fork
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would always be from a fork, no?

script: |
const prDetails = ${{ steps.pr-details.outputs.result }};
const timestamp = new Date().getTime();
const ciBranchName = `ci-test/${prDetails.number}-${timestamp}`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

timestamp seems unnecessary. PR numbers are unique.

Unless we are planning on creating a new branch each time this workflow is run, but my thinking was that we'd have a 1:1 relationship, and the test PR would update if the branch already exists and /run-ci is invoked for future updates on a given PR. Maybe this is fine for now as :itg: though

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot implement this

Copy link
Contributor

Copilot AI commented Dec 2, 2025

@pranaygp I've opened a new pull request, #493, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Dec 2, 2025

@pranaygp I've opened a new pull request, #494, to work on those changes. Once the pull request is ready, I'll request review from you.

* Initial plan

* Extract inline scripts to separate files

Co-authored-by: pranaygp <[email protected]>

* Fix indentation in create-ci-pr.js

Co-authored-by: pranaygp <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: pranaygp <[email protected]>
@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2025

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

World Framework Workflow Time Wall Time Overhead vs Fastest
💻 Local 🥇 Express 0.038s (-15.5% 🟢) 1.010s (~) 0.972s 1.00x
💻 Local Next.js (Turbopack) 0.042s (+10.0% 🔺) 1.018s (~) 0.976s 1.11x
💻 Local Nitro 0.043s (-1.6%) 1.007s (~) 0.964s 1.14x
🐘 Postgres Nitro 0.341s (+48.1% 🔺) 1.013s (-1.1%) 0.672s 9.08x
🐘 Postgres Next.js (Turbopack) 0.372s (-7.2% 🟢) 1.023s (~) 0.651s 9.89x
🐘 Postgres Express 0.409s (+72.0% 🔺) 1.015s (~) 0.605s 10.89x

workflow with 1 step

World Framework Workflow Time Wall Time Overhead vs Fastest
💻 Local 🥇 Next.js (Turbopack) 0.089s (+12.2% 🔺) 1.012s (~) 0.923s 1.00x
💻 Local Express 0.094s (-18.2% 🟢) 1.009s (~) 0.915s 1.05x
💻 Local Nitro 0.110s (-1.8%) 1.006s (~) 0.896s 1.23x
🐘 Postgres Nitro 1.209s (+4.3%) 2.011s (~) 0.802s 13.57x
🐘 Postgres Next.js (Turbopack) 1.212s (+35.1% 🔺) 1.917s (+57.8% 🔺) 0.705s 13.60x
🐘 Postgres Express 1.222s (+10.6% 🔺) 2.011s (~) 0.790s 13.71x

workflow with 10 sequential steps

World Framework Workflow Time Wall Time Overhead vs Fastest
💻 Local 🥇 Express 0.590s (-24.2% 🟢) 1.009s (~) 0.420s 1.00x
💻 Local Next.js (Turbopack) 0.636s (+25.3% 🔺) 1.010s (~) 0.374s 1.08x
💻 Local Nitro 0.770s (-2.2%) 1.005s (~) 0.236s 1.31x
🐘 Postgres Next.js (Turbopack) 4.871s (-6.0% 🟢) 5.418s (-10.0% 🟢) 0.547s 8.26x
🐘 Postgres Express 10.113s (-3.6%) 11.024s (~) 0.912s 17.15x
🐘 Postgres Nitro 10.192s (+97.4% 🔺) 11.024s (+89.6% 🔺) 0.832s 17.29x

workflow with 10 parallel steps

World Framework Workflow Time Wall Time Overhead vs Fastest
💻 Local 🥇 Nitro 0.388s (-3.3%) 1.005s (~) 0.618s 1.00x
💻 Local Next.js (Turbopack) 0.391s (-4.0%) 1.009s (~) 0.618s 1.01x
💻 Local Express 0.415s (+4.4%) 1.008s (~) 0.593s 1.07x
🐘 Postgres Next.js (Turbopack) 1.183s (+47.2% 🔺) 1.851s (+82.4% 🔺) 0.668s 3.05x
🐘 Postgres Express 1.640s (+3.1%) 2.015s (~) 0.375s 4.23x
🐘 Postgres Nitro 1.697s (+53.8% 🔺) 2.015s (+24.5% 🔺) 0.318s 4.38x

Stream Benchmarks

Stream benchmarks include Time to First Byte (TTFB) metrics.

workflow with stream

World Framework Workflow Time TTFB Wall Time Overhead vs Fastest
💻 Local 🥇 Express 0.136s (-25.9% 🟢) 1.000s (+0.8%) 1.011s (~) 0.875s 1.00x
💻 Local Next.js (Turbopack) 0.144s (+26.4% 🔺) 1.003s (~) 1.014s (~) 0.870s 1.06x
💻 Local Nitro 0.177s (-1.2%) 0.992s (~) 1.008s (~) 0.831s 1.30x
🐘 Postgres Next.js (Turbopack) 0.768s (-46.1% 🟢) 0.832s (-48.5% 🟢) 1.016s (-49.6% 🟢) 0.248s 5.66x
🐘 Postgres Express 1.062s (-52.6% 🟢) 0.982s (-65.0% 🟢) 1.310s (-56.5% 🟢) 0.248s 7.82x
🐘 Postgres Nitro 2.372s (+212.3% 🔺) 2.668s (+213.6% 🔺) 3.014s (+198.6% 🔺) 0.642s 17.46x

Summary: Fastest Framework by World

Winner determined by most benchmark wins

World 🥇 Fastest Framework Wins
💻 Local Express 3/5
🐘 Postgres Next.js (Turbopack) 3/5

Summary: Fastest World by Framework

Winner determined by most benchmark wins

Framework 🥇 Fastest World Wins
Express 💻 Local 5/5
Next.js (Turbopack) 💻 Local 5/5
Nitro 💻 Local 5/5
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world
  • 🐘 Postgres: PostgreSQL database world
  • ▲ Vercel: Vercel production world

⚠️ Some benchmark jobs failed:

  • Local: success
  • Postgres: success
  • Vercel: failure

Check the workflow run for details.

return {
head_ref: pr.data.head.ref,
head_sha: pr.data.head.sha,
head_repo_full_name: pr.data.head.repo.full_name,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code will crash with a TypeError when a PR is from a deleted fork, because it tries to access full_name on a null object. When a fork is deleted, GitHub returns head.repo as null in the PR data.

View Details
📝 Patch Details
diff --git a/.github/scripts/get-pr-details.js b/.github/scripts/get-pr-details.js
index 88a0ce5..3aad14c 100644
--- a/.github/scripts/get-pr-details.js
+++ b/.github/scripts/get-pr-details.js
@@ -5,6 +5,16 @@ module.exports = async ({ github, context }) => {
     pull_number: context.issue.number
   });
   
+  if (!pr.data.head.repo) {
+    await github.rest.issues.createComment({
+      owner: context.repo.owner,
+      repo: context.repo.repo,
+      issue_number: context.issue.number,
+      body: '❌ Cannot run CI: The source fork for this PR has been deleted. The fork must exist in order to fetch the changes and run CI tests.'
+    });
+    throw new Error('Source fork has been deleted');
+  }
+  
   return {
     head_ref: pr.data.head.ref,
     head_sha: pr.data.head.sha,

Analysis

Unhandled null reference crash when PR is from deleted fork

What fails: The script .github/scripts/get-pr-details.js at line 11 crashes with TypeError: Cannot read properties of null (reading 'full_name') when attempting to access pr.data.head.repo.full_name without checking if head.repo is null.

How to reproduce:

  1. Create a pull request from an external fork
  2. Delete the external fork
  3. Comment /run-ci on the original PR
  4. The workflow "Trigger CI for External PRs" will crash in the "Get PR details" step

Result: Crashes with: Error: Cannot read properties of null (reading 'full_name')

Expected behavior: Should gracefully handle the deleted fork scenario and post a helpful error message to the PR, as documented in the octokit/rest.js issue #31. When a PR originates from an "unknown repository" (i.e., deleted fork), the GitHub API returns head.repo as null.

Fix implemented:

  • Added null check for pr.data.head.repo before accessing its properties
  • Posts a user-friendly error comment to the PR explaining why CI cannot run
  • Throws an error to fail the workflow gracefully instead of crashing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants