Merge pull request #181 from github/elbrenn/skip-secret-validation

Skip secret validation for workflow_call
This commit is contained in:
Beth Brennan
2023-03-14 11:25:56 -04:00
committed by GitHub
3 changed files with 37 additions and 15 deletions
@@ -11,10 +11,12 @@ export function getSecretsContext(workflowContext: WorkflowContext, mode: Mode):
description: getDescription("secrets", "GITHUB_TOKEN")
});
if (mode === Mode.Completion) {
const eventsConfig = workflowContext?.template?.events;
if (eventsConfig?.workflow_call?.secrets) {
for (const [name, value] of Object.entries(eventsConfig.workflow_call.secrets)) {
const eventsConfig = workflowContext?.template?.events;
if (eventsConfig?.workflow_call) {
// Unpredictable secrets may be passed in via a workflow_call trigger
d.complete = false;
if (mode === Mode.Completion) {
for (const [name, value] of Object.entries(eventsConfig.workflow_call.secrets || {})) {
d.add(name, new StringData(""), value.description);
}
}
@@ -98,6 +98,25 @@ jobs:
]);
});
it("no secret validation with workflow_call", async () => {
const input = `
on:
workflow_call:
secrets:
my_secret:
env:
my_secret: \${{ secrets.my_secret }}
secret: \${{ secrets.secret-not-exist }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: echo`;
const result = await validate(createDocument("wf.yaml", input));
expect(result).toEqual([]);
});
it("access invalid nested context field", async () => {
const result = await validate(
createDocument(