stackblitz-labs / stackblitz-labs/pkg.pr.new

Error `no workflow defined for` when workflow is triggered by `Approve and run`

Open
#553 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.9k
Forks
127
PR merge metrics
No merged PRs in 30d

Description

When a workflow is triggered by maintainer clicking Approve and run for first time contributoros, pkg.pr.new fails with There is no workflow defined for ... error.

Image

🤖 analysis of the root cause indicating mis-match between GITHUB_ACTOR_ID and sender.id:

/check 404s on re-runs and approval-gated fork PRs: CLI keys on GITHUB_ACTOR_ID but webhook keys on sender.id

pkg-pr-new publish fails with Check failed (404): There is no workflow defined for <key> whenever the person who caused the current workflow attempt to run is not the original triggering actor — i.e. a maintainer re-running a fork PR's jobs, or approving a first-time contributor's run.

Cause

The CLI and the webhook handler compute the storage key from different actor IDs:

  • CLI (packages/cli/index.ts) hashes { owner, repo, run, attempt, actor: GITHUB_ACTOR_ID }. Per GitHub's docs, GITHUB_ACTOR is the user who triggered the initial run — on a re-run it stays the original actor and does not become the re-runner (GITHUB_TRIGGERING_ACTOR does).
  • The server (packages/app/server/routes/webhook.post.ts) stores the workflow entry under { owner, repo, run, attempt, actor: payload.sender.id }. On a workflow_run webhook for a re-run/approved run, sender is the maintainer who clicked re-run/approve.

So for attempt N of a re-run: webhook stores under hash(..., actor: maintainer_id), CLI looks up hash(..., actor: pr_author_id) → key not found → 404.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing actor-ID handling in packages/cli/index.ts with packages/app/server/routes/webhook.post.ts, focusing on how the workflow storage key is built. Reproduce or trace an approved or re-run fork pull request and verify that the CLI and webhook use the same key so pkg.pr.new no longer returns the 404 workflow error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, ci-cd, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.