Skip to content

fix: get job inputs action uses dispatch ctx#865

Merged
adityachoudhari26 merged 1 commit intomainfrom
update-get-job-inputs
Mar 24, 2026
Merged

fix: get job inputs action uses dispatch ctx#865
adityachoudhari26 merged 1 commit intomainfrom
update-get-job-inputs

Conversation

@adityachoudhari26
Copy link
Copy Markdown
Member

@adityachoudhari26 adityachoudhari26 commented Mar 24, 2026

Summary by CodeRabbit

Release Notes

  • Refactor
    • Updated GitHub Actions job input processing to restructure how job-related fields are sourced. Certain job details may now be unavailable when dispatch context is absent.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 24, 2026

📝 Walkthrough

Walkthrough

The changes refactor job data sourcing in GitHub Actions integration by destructuring job.job to extract dispatchContext separately. Job fields like variables, resource, version, environment, and deployment are now sourced from dispatchContext instead of their previous locations on the job object.

Changes

Cohort / File(s) Summary
GitHub Actions Job Input Extraction
github/get-job-inputs/index.js, integrations/github-get-job-inputs/src/index.ts
Refactored ghActionsJobObject construction to destructure job.job into dispatchContext and remaining properties. Job metadata fields (variables, resource, version, environment, deployment) now sourced from dispatchContext with optional chaining instead of from job.release and sibling properties, making these fields conditional on dispatchContext presence.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • jsbroks

Poem

🐰 Data flows from contexts new,
Destructuring what once was true,
Optional chains now lead the way,
To dispatchContext's data play! 📋✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: updating the get-job-inputs action to use dispatch context instead of previous properties.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch update-get-job-inputs

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.js

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Member

@zacharyblasczyk zacharyblasczyk left a comment

Choose a reason for hiding this comment

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

Looks good?

Copy link
Copy Markdown
Member

@zacharyblasczyk zacharyblasczyk left a comment

Choose a reason for hiding this comment

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

🚢

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between d1f9848 and ce5a9a6.

📒 Files selected for processing (2)
  • github/get-job-inputs/index.js
  • integrations/github-get-job-inputs/src/index.ts

Comment on lines 77 to +85
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,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

@adityachoudhari26 adityachoudhari26 merged commit 30d295d into main Mar 24, 2026
5 of 6 checks passed
@adityachoudhari26 adityachoudhari26 deleted the update-get-job-inputs branch March 24, 2026 21:47
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