Add jobs context (#160)

This commit is contained in:
Laura Yu
2023-02-23 11:19:07 -08:00
committed by GitHub
parent e8902e78d3
commit 6843c36809
5 changed files with 202 additions and 0 deletions
@@ -404,6 +404,55 @@ jobs:
});
});
describe("jobs context", () => {
it("jobs.<job_id>.result", async () => {
const input = `
on:
workflow_call:
# Map the workflow outputs to job outputs
outputs:
successful:
description: "Was job successful"
value: \${{ jobs.example_job.result }}
jobs:
example_job:
runs-on: ubuntu-latest
steps:
- id: a
run: echo hello world`;
const result = await validate(createDocument("wf.yaml", input));
expect(result).toEqual([]);
});
it("jobs.<job_id>.outputs.<output_name>", async () => {
const input = `
on:
workflow_call:
outputs:
output1:
description: "A greeting"
value: \${{ jobs.example_job.outputs.output1 }}
jobs:
example_job:
name: Generate output
runs-on: ubuntu-latest
# Map the job outputs to step outputs
outputs:
output1: "\${{ steps.a.outputs.greeting }}"
steps:
- id: a
run: echo "greeting=hello" >> $GITHUB_OUTPUT`;
const result = await validate(createDocument("wf.yaml", input));
expect(result).toEqual([]);
});
});
describe("env context", () => {
it("references env within scope", async () => {
const input = `