Merge pull request #25 from github/joshmgross/update-job-references

Update references to `Job` and `Step`
This commit is contained in:
Josh Gross
2022-12-01 14:45:41 -05:00
committed by GitHub
3 changed files with 12 additions and 12 deletions
@@ -1,5 +1,5 @@
import {WorkflowTemplate} from "@github/actions-workflow-parser";
import {JobConfig, StepConfig} from "@github/actions-workflow-parser/model/workflow-template";
import {Job, Step} from "@github/actions-workflow-parser/model/workflow-template";
import {StringToken} from "@github/actions-workflow-parser/templates/tokens/string-token";
import {TemplateToken} from "@github/actions-workflow-parser/templates/tokens/template-token";
@@ -9,10 +9,10 @@ export interface WorkflowContext {
template: WorkflowTemplate | undefined;
/** If the context is for a position within a job, this will be the job */
job?: JobConfig;
job?: Job;
/** If the context is for a position within a step, this will be the step */
step?: StepConfig;
step?: Step;
}
export function getWorkflowContext(
@@ -30,7 +30,7 @@ export function getWorkflowContext(
switch (token.definition?.key) {
case "job-id": {
const jobID = (token as StringToken).value;
context.job = template.jobs.find(job => job.id === jobID);
context.job = template.jobs.find(job => job.id.value === jobID);
}
}
}
@@ -8,6 +8,6 @@ export async function needs(context: WorkflowContext): Promise<Value[]> {
const uniquejobIDs = new Set(context.template.jobs.map(j => j.id)).values();
return Array.from(uniquejobIDs)
.filter(x => x !== context.job?.id)
.map(x => ({label: x}));
.filter(x => x.value !== context.job?.id.value)
.map(x => ({label: x.value}));
}
+6 -6
View File
@@ -665,9 +665,9 @@
"link": true
},
"node_modules/@github/actions-workflow-parser": {
"version": "0.0.20",
"resolved": "https://npm.pkg.github.com/download/@github/actions-workflow-parser/0.0.20/cfba09f790505ad7f811d3ba63981f9a22562b82",
"integrity": "sha512-85C1iony9CclubBCGFNY3wcvDE+FeGHZ92bEYd5XdseFEtAU5UjAF85nBAd55mEzEh+f/mJq8RK3s0rMLqv5pQ==",
"version": "0.0.23",
"resolved": "https://npm.pkg.github.com/download/@github/actions-workflow-parser/0.0.23/4fe24783761ab3ae620f6a4199c27f6d1bd2da03",
"integrity": "sha512-oYV5pKB9jryDM8BKzR0amuL96Xhq/aCswffv/ugQntogmKPQloYFJQv1Rpe9WMFQvM4Ws2KpYvpBsVwS3rwZyw==",
"license": "MIT",
"dependencies": {
"@github/actions-expressions": "*",
@@ -10927,9 +10927,9 @@
}
},
"@github/actions-workflow-parser": {
"version": "0.0.20",
"resolved": "https://npm.pkg.github.com/download/@github/actions-workflow-parser/0.0.20/cfba09f790505ad7f811d3ba63981f9a22562b82",
"integrity": "sha512-85C1iony9CclubBCGFNY3wcvDE+FeGHZ92bEYd5XdseFEtAU5UjAF85nBAd55mEzEh+f/mJq8RK3s0rMLqv5pQ==",
"version": "0.0.23",
"resolved": "https://npm.pkg.github.com/download/@github/actions-workflow-parser/0.0.23/4fe24783761ab3ae620f6a4199c27f6d1bd2da03",
"integrity": "sha512-oYV5pKB9jryDM8BKzR0amuL96Xhq/aCswffv/ugQntogmKPQloYFJQv1Rpe9WMFQvM4Ws2KpYvpBsVwS3rwZyw==",
"requires": {
"@github/actions-expressions": "*",
"yaml": "^2.0.0-8"