Skip to content

Fix TypeError on pull_request.number for workflow_call trigger#19

Merged
gobetti merged 1 commit intomainfrom
fix/workflow-call-pr-number
Mar 4, 2026
Merged

Fix TypeError on pull_request.number for workflow_call trigger#19
gobetti merged 1 commit intomainfrom
fix/workflow-call-pr-number

Conversation

@gobetti
Copy link
Contributor

@gobetti gobetti commented Mar 4, 2026

Summary

  • context.payload.pull_request is undefined when the workflow is triggered via workflow_call, causing TypeError: Cannot read properties of undefined (reading 'number')
  • Falls back to listing open PRs for the current branch ref via the GitHub API to find the PR number
  • Gracefully skips the update if no open PR is found

Test plan

  • Trigger via workflow_call — "Build and update PR body" step should complete without TypeError
  • Confirm normal pull_request [opened] trigger still works

🤖 Generated with Claude Code

📝 Auto-filled

context.payload.pull_request is undefined for workflow_call events,
causing TypeError on .number. Fall back to looking up the open PR
by branch ref via the REST API.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gobetti gobetti merged commit 0d4ff63 into main Mar 4, 2026
1 check passed
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.

2 participants