Fix Job references in language server

This commit is contained in:
Josh Gross
2023-02-03 17:24:31 -05:00
parent 6124e78f28
commit 574216178b
4 changed files with 23 additions and 15 deletions
@@ -1,7 +1,7 @@
import {data, DescriptionDictionary, isDescriptionDictionary} from "@github/actions-expressions";
import {parseActionReference} from "@github/actions-languageservice/action";
import {WorkflowContext} from "@github/actions-languageservice/context/workflow-context";
import {isActionStep} from "@github/actions-workflow-parser/model/type-guards";
import {isActionStep, isReusableWorkflowJob} from "@github/actions-workflow-parser/model/type-guards";
import {Octokit} from "@octokit/rest";
import {TTLCache} from "../utils/cache";
import {getActionOutputs} from "./action-outputs";
@@ -12,7 +12,8 @@ export async function getStepsContext(
defaultContext: DescriptionDictionary | undefined,
workflowContext: WorkflowContext
): Promise<DescriptionDictionary | undefined> {
if (!defaultContext || !workflowContext.job) {
const job = workflowContext.job;
if (!defaultContext || !job || isReusableWorkflowJob(job)) {
return defaultContext;
}
@@ -26,7 +27,7 @@ export async function getStepsContext(
// Copy the default context for each step
// If the step is an action, add the action outputs to the context
const stepsContext = new DescriptionDictionary();
for (const step of workflowContext.job.steps) {
for (const step of job.steps) {
if (!contextSteps.has(step.id)) {
continue;
}