fix: get job inputs action uses dispatch ctx#865
Conversation
📝 WalkthroughWalkthroughThe changes refactor job data sourcing in GitHub Actions integration by destructuring Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.41.1)github/get-job-inputs/index.jsThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@integrations/github-get-job-inputs/src/index.ts`:
- Around line 77-85: The current ghActionsJobObject construction overwrites
pre-existing output fields from ...restJob with undefined when dispatchContext
is partial; update each dispatchContext-based assignment (variable, resource,
version, environment, deployment) to fall back to the original restJob values
(or their legacy keys) when dispatchContext or the specific key is undefined
(e.g., use dispatchContext?.variables ?? restJob.variable, and similarly for
resource/version/environment/deployment) so that missing dispatchContext entries
do not blank out existing outputs in ghActionsJobObject.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 54d733ba-a262-40ca-8434-db2c46b0e2b1
📒 Files selected for processing (2)
github/get-job-inputs/index.jsintegrations/github-get-job-inputs/src/index.ts
| const ghActionsJobObject = { | ||
| ...job.job, | ||
| ...restJob, | ||
| base: { url: baseUrl }, | ||
| variable: job.release.variables, | ||
| resource: job.resource, | ||
| version: job.release.version, | ||
| variable: dispatchContext?.variables, | ||
| resource: dispatchContext?.resource, | ||
| version: dispatchContext?.version, | ||
| workspace: { id: job.workspaceId }, | ||
| environment: job.environment, | ||
| deployment: job.deployment, | ||
| environment: dispatchContext?.environment, | ||
| deployment: dispatchContext?.deployment, |
There was a problem hiding this comment.
Don't let a partial dispatchContext blank out existing outputs.
Because these assignments happen after ...restJob, a missing dispatchContext key overwrites the legacy value with undefined. For jobs where dispatchContext is {} or only partially populated, outputs like resource_*, environment_*, or deployment_* stop being emitted and can trip the required_outputs failure path.
💡 Suggested fallback
const ghActionsJobObject = {
...restJob,
base: { url: baseUrl },
- variable: dispatchContext?.variables,
- resource: dispatchContext?.resource,
- version: dispatchContext?.version,
+ variable: dispatchContext?.variables ?? job.release?.variables,
+ resource: dispatchContext?.resource ?? restJob.resource,
+ version: dispatchContext?.version ?? job.release?.version,
workspace: { id: job.workspaceId },
- environment: dispatchContext?.environment,
- deployment: dispatchContext?.deployment,
+ environment: dispatchContext?.environment ?? restJob.environment,
+ deployment: dispatchContext?.deployment ?? restJob.deployment,
};🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@integrations/github-get-job-inputs/src/index.ts` around lines 77 - 85, The
current ghActionsJobObject construction overwrites pre-existing output fields
from ...restJob with undefined when dispatchContext is partial; update each
dispatchContext-based assignment (variable, resource, version, environment,
deployment) to fall back to the original restJob values (or their legacy keys)
when dispatchContext or the specific key is undefined (e.g., use
dispatchContext?.variables ?? restJob.variable, and similarly for
resource/version/environment/deployment) so that missing dispatchContext entries
do not blank out existing outputs in ghActionsJobObject.
Summary by CodeRabbit
Release Notes