From 7e5c8d20aee393fbbe3e1d651dd2ecfded8da0e7 Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Thu, 8 Dec 2022 13:55:19 -0500 Subject: [PATCH 01/18] Skip context validation when matrices have expressions --- actions-languageservice/src/context-providers/default.ts | 8 ++++++-- .../src/context-providers/matrix.test.ts | 8 ++++---- actions-languageservice/src/context-providers/matrix.ts | 7 ++++--- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/actions-languageservice/src/context-providers/default.ts b/actions-languageservice/src/context-providers/default.ts index 4b35267..3782223 100644 --- a/actions-languageservice/src/context-providers/default.ts +++ b/actions-languageservice/src/context-providers/default.ts @@ -7,6 +7,10 @@ import {getNeedsContext} from "./needs"; import {getStepsContext} from "./steps"; import {getStrategyContext} from "./strategy"; +// ContextValue is the type of the value returned by a context provider +// Null indicates that the context provider doesn't have any value to provide +export type ContextValue = data.Dictionary | data.Null; + export async function getContext( names: string[], config: ContextProviderConfig | undefined, @@ -16,7 +20,7 @@ export async function getContext( const filteredNames = filterContextNames(names, workflowContext); for (const contextName of filteredNames) { - let value: data.Dictionary | undefined; + let value: ContextValue | undefined; value = await getDefaultContext(contextName, workflowContext); @@ -34,7 +38,7 @@ export async function getContext( return context; } -async function getDefaultContext(name: string, workflowContext: WorkflowContext): Promise { +async function getDefaultContext(name: string, workflowContext: WorkflowContext): Promise { switch (name) { case "runner": return objectToDictionary({ diff --git a/actions-languageservice/src/context-providers/matrix.test.ts b/actions-languageservice/src/context-providers/matrix.test.ts index b1a0d48..a1e473c 100644 --- a/actions-languageservice/src/context-providers/matrix.test.ts +++ b/actions-languageservice/src/context-providers/matrix.test.ts @@ -88,7 +88,7 @@ describe("matrix context", () => { const workflowContext = contextFromStrategy(strategy); const context = getMatrixContext(workflowContext); - expect(context).toEqual(new data.Dictionary()); + expect(context).toEqual(new data.Null()); }); it("matrix is not a mapping token", () => { @@ -97,7 +97,7 @@ describe("matrix context", () => { const workflowContext = contextFromStrategy(strategy); const context = getMatrixContext(workflowContext); - expect(context).toEqual(new data.Dictionary()); + expect(context).toEqual(new data.Null()); }); it("empty matrix", () => { @@ -118,7 +118,7 @@ describe("matrix context", () => { const workflowContext = contextFromStrategy(strategy); const context = getMatrixContext(workflowContext); - expect(context).toEqual(new data.Dictionary()); + expect(context).toEqual(new data.Null()); }); it("matrix with include expression", () => { @@ -138,7 +138,7 @@ describe("matrix context", () => { const workflowContext = contextFromStrategy(strategy); const context = getMatrixContext(workflowContext); - expect(context).toEqual(new data.Dictionary()); + expect(context).toEqual(new data.Null()); }); it("matrix with expression within property", () => { diff --git a/actions-languageservice/src/context-providers/matrix.ts b/actions-languageservice/src/context-providers/matrix.ts index c13f6ac..f3d8b4c 100644 --- a/actions-languageservice/src/context-providers/matrix.ts +++ b/actions-languageservice/src/context-providers/matrix.ts @@ -4,8 +4,9 @@ import {KeyValuePair} from "@github/actions-workflow-parser/templates/tokens/key import {MappingToken} from "@github/actions-workflow-parser/templates/tokens/mapping-token"; import {SequenceToken} from "@github/actions-workflow-parser/templates/tokens/sequence-token"; import {WorkflowContext} from "../context/workflow-context"; +import {ContextValue} from "./default"; -export function getMatrixContext(workflowContext: WorkflowContext): data.Dictionary { +export function getMatrixContext(workflowContext: WorkflowContext): ContextValue { // https://docs.github.com/en/actions/learn-github-actions/contexts#matrix-context const strategy = workflowContext.job?.strategy; if (!strategy || !isMapping(strategy)) { @@ -15,13 +16,13 @@ export function getMatrixContext(workflowContext: WorkflowContext): data.Diction const matrix = strategy.find("matrix"); if (!matrix || !isMapping(matrix)) { // Matrix could be an expression, so there's no context we can provide - return new data.Dictionary(); + return new data.Null(); } const properties = matrixProperties(matrix); if (!properties) { // Matrix included an expression, so there's no context we can provide - return new data.Dictionary(); + return new data.Null(); } const d = new data.Dictionary(); From f2c04b7b899eed4282f11035c11f974c2f315466 Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Thu, 8 Dec 2022 13:55:46 -0500 Subject: [PATCH 02/18] Ensure context is inherited in validation --- actions-languageservice/src/complete.ts | 2 +- actions-languageservice/src/utils/allowed-context.ts | 4 ++-- actions-languageservice/src/validate.ts | 11 +++++++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/actions-languageservice/src/complete.ts b/actions-languageservice/src/complete.ts index ca9d58c..db85d6c 100644 --- a/actions-languageservice/src/complete.ts +++ b/actions-languageservice/src/complete.ts @@ -84,7 +84,7 @@ export async function complete( const expressionInput = (getExpressionInput(currentInput, relCharPos) || "").trim(); - const allowedContext = getAllowedContext(token, parent!); + const allowedContext = getAllowedContext(token, parent); const context = await getContext(allowedContext, contextProviderConfig, workflowContext); return completeExpression(expressionInput, context, []); diff --git a/actions-languageservice/src/utils/allowed-context.ts b/actions-languageservice/src/utils/allowed-context.ts index 0eb8704..36a5d91 100644 --- a/actions-languageservice/src/utils/allowed-context.ts +++ b/actions-languageservice/src/utils/allowed-context.ts @@ -1,11 +1,11 @@ import {TemplateToken} from "@github/actions-workflow-parser/templates/tokens/template-token"; -export function getAllowedContext(token: TemplateToken, parent: TemplateToken): string[] { +export function getAllowedContext(token: TemplateToken, parent: TemplateToken | null | undefined): string[] { // Workaround for https://github.com/github/c2c-actions-experience/issues/6876 // Context is inherited from the parent const allowedContext = new Set(); for (const t of [token, parent]) { - if (t.definition?.readerContext) { + if (t?.definition?.readerContext) { for (const context of t.definition.readerContext) { allowedContext.add(context); } diff --git a/actions-languageservice/src/validate.ts b/actions-languageservice/src/validate.ts index d0ca448..7592795 100644 --- a/actions-languageservice/src/validate.ts +++ b/actions-languageservice/src/validate.ts @@ -23,6 +23,7 @@ import {getContext} from "./context-providers/default"; import {getWorkflowContext, WorkflowContext} from "./context/workflow-context"; import {AccessError, wrapDictionary} from "./expression-validation/error-dictionary"; import {nullTrace} from "./nulltrace"; +import {getAllowedContext} from "./utils/allowed-context"; import {findToken} from "./utils/find-token"; import {mapRange} from "./utils/range"; import {ValueProviderConfig, ValueProviderKind} from "./value-providers/config"; @@ -75,6 +76,7 @@ export async function validate( } } catch (e) { // TODO: Handle error here + console.error(e); } return diagnostics; @@ -94,12 +96,14 @@ async function additionalValidations( const validationToken = key || parent || token; const validationDefinition = validationToken.definition; + const allowedContext = getAllowedContext(validationToken, parent); + // If this is an expression, validate it if (isBasicExpression(token)) { await validateExpression( diagnostics, token, - validationDefinition, + allowedContext, contextProviderConfig, getProviderContext(documentUri, template, root, token) ); @@ -170,14 +174,13 @@ function getProviderContext( async function validateExpression( diagnostics: Diagnostic[], token: BasicExpressionToken, - definition: Definition | undefined, + allowedContext: string[], contextProviderConfig: ContextProviderConfig | undefined, workflowContext: WorkflowContext ) { // Validate the expression for (const expression of token.originalExpressions || [token]) { - const allowedContexts = definition?.readerContext || []; - const {namedContexts, functions} = splitAllowedContext(allowedContexts); + const {namedContexts, functions} = splitAllowedContext(allowedContext); let expr: Expr | undefined; From 1d93b25b9144c2743f346b11b1880c1d994ac41e Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Thu, 8 Dec 2022 13:55:58 -0500 Subject: [PATCH 03/18] Add tests for validating matrix context --- .../src/validate.expressions.test.ts | 350 ++++++++++++++++++ 1 file changed, 350 insertions(+) diff --git a/actions-languageservice/src/validate.expressions.test.ts b/actions-languageservice/src/validate.expressions.test.ts index 5b1afd0..6317204 100644 --- a/actions-languageservice/src/validate.expressions.test.ts +++ b/actions-languageservice/src/validate.expressions.test.ts @@ -301,4 +301,354 @@ jobs: ]); }); }); + + describe("matrix context", () => { + it("reference within a matrix job", async () => { + const input = ` +on: push + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + node: [14, 16] + steps: + - uses: actions/checkout@v3 + - run: echo \${{ matrix.node }} +`; + + const result = await validate(createDocument("wf.yaml", input)); + + expect(result).toEqual([]); + }); + + it("reference outside of a matrix job", async () => { + const input = ` +on: push + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: echo \${{ matrix.node }} +`; + + const result = await validate(createDocument("wf.yaml", input)); + + expect(result).toEqual([ + { + message: "Context access might be invalid: matrix", + range: { + end: { + character: 36, + line: 8 + }, + start: { + character: 18, + line: 8 + } + }, + severity: DiagnosticSeverity.Warning + } + ]); + }); + + it("basic matrix", async () => { + const input = ` +on: push + +jobs: + test: + runs-on: \${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + node: [14, 16] + steps: + - uses: actions/checkout@v3 + - run: echo \${{ matrix.node }} +`; + + const result = await validate(createDocument("wf.yaml", input)); + + expect(result).toEqual([]); + }); + + it("invalid property reference", async () => { + const input = ` +on: push + +jobs: + test: + runs-on: \${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + node: [14, 16] + include: + - os: macos-latest + node: 14 + exclude: + - os: windows-latest + node: 14 + steps: + - uses: actions/checkout@v3 + - run: echo \${{ matrix.goversion }} +`; + + const result = await validate(createDocument("wf.yaml", input)); + + expect(result).toEqual([ + { + message: "Context access might be invalid: goversion", + range: { + end: { + character: 41, + line: 18 + }, + start: { + character: 18, + line: 18 + } + }, + severity: DiagnosticSeverity.Warning + } + ]); + }); + + it("matrix with include", async () => { + const input = ` +on: push + +jobs: + test: + runs-on: \${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + node: [14, 16] + include: + - os: macos-latest + node: 14 + steps: + - uses: actions/checkout@v3 + - run: echo \${{ matrix.node }} +`; + + const result = await validate(createDocument("wf.yaml", input)); + + expect(result).toEqual([]); + }); + + it("matrix with only include", async () => { + const input = ` +on: push + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - os: windows-latest + node: 14 + steps: + - uses: actions/checkout@v3 + - run: echo \${{ matrix.os }} + - run: echo \${{ matrix.node }} +`; + + const result = await validate(createDocument("wf.yaml", input)); + + expect(result).toEqual([]); + }); + + it("matrix with exclude", async () => { + const input = ` +on: push + +jobs: + test: + runs-on: \${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + node: [14, 16] + include: + - os: macos-latest + node: 14 + exclude: + - os: windows-latest + node: 14 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: \${{ matrix.node }} +`; + + const result = await validate(createDocument("wf.yaml", input)); + + expect(result).toEqual([]); + }); + + it("matrix with only exclude", async () => { + const input = ` +on: push + +jobs: + test: + runs-on: \${{ matrix.os }} + strategy: + matrix: + exclude: + - os: windows-latest + node: 14 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: \${{ matrix.node }} +`; + + const result = await validate(createDocument("wf.yaml", input)); + + expect(result).toEqual([ + { + message: "Context access might be invalid: os", + range: { + end: { + character: 29, + line: 5 + }, + start: { + character: 13, + line: 5 + } + }, + severity: DiagnosticSeverity.Warning + }, + { + message: "Context access might be invalid: node", + range: { + end: { + character: 42, + line: 15 + }, + start: { + character: 24, + line: 15 + } + }, + severity: DiagnosticSeverity.Warning + } + ]); + }); + + it("matrix from expression", async () => { + const input = ` +on: push + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: \${{ fromJSON('{"color":["green","blue"]}') }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: \${{ matrix.ANYVALUE }} +`; + + const result = await validate(createDocument("wf.yaml", input)); + + expect(result).toEqual([]); + }); + + it("matrix with include expression", async () => { + const input = ` +on: push + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + fruit: [apple, pear] + animal: [cat, dog] + include: \${{ fromJSON('{"color":"green"}') }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: \${{ matrix.ANYVALUE }} +`; + + const result = await validate(createDocument("wf.yaml", input)); + + expect(result).toEqual([]); + }); + + it("matrix with property expression", async () => { + const input = ` +on: push + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + color: \${{ fromJSON('["green","blue"]') }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: \${{ matrix.color }} +`; + + const result = await validate(createDocument("wf.yaml", input)); + + expect(result).toEqual([]); + }); + + it("matrix with property expression and invalid property reference", async () => { + const input = ` +on: push + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + color: \${{ fromJSON('["green","blue"]') }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: \${{ matrix.shape }} +`; + + const result = await validate(createDocument("wf.yaml", input)); + + expect(result).toEqual([ + { + message: "Context access might be invalid: shape", + range: { + end: { + character: 43, + line: 13 + }, + start: { + character: 24, + line: 13 + } + }, + severity: DiagnosticSeverity.Warning + } + ]); + }); + }); }); From 2f88970fceba7acce67bd878824337d5790359c7 Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Thu, 8 Dec 2022 14:05:04 -0500 Subject: [PATCH 04/18] Skip external context provider when value is null --- actions-languageservice/src/context-providers/default.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/actions-languageservice/src/context-providers/default.ts b/actions-languageservice/src/context-providers/default.ts index 9dca41e..784c693 100644 --- a/actions-languageservice/src/context-providers/default.ts +++ b/actions-languageservice/src/context-providers/default.ts @@ -1,4 +1,5 @@ import {data} from "@github/actions-expressions"; +import {Kind} from "@github/actions-expressions/data/expressiondata"; import {WorkflowContext} from "../context/workflow-context"; import {ContextProviderConfig} from "./config"; import {getInputsContext} from "./inputs"; @@ -21,6 +22,10 @@ export async function getContext( const filteredNames = filterContextNames(names, workflowContext); for (const contextName of filteredNames) { let value = (await getDefaultContext(contextName, workflowContext)) || new data.Dictionary(); + if (value.kind === Kind.Null) { + context.add(contextName, value); + continue; + } value = (await config?.getContext(contextName, value)) || value; From eeb39de9d5f99ae05e37587e48852ce61e067933 Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Thu, 8 Dec 2022 14:34:11 -0500 Subject: [PATCH 05/18] Support partial matrix context completion --- .../src/complete.expressions.test.ts | 2 +- actions-languageservice/src/complete.ts | 2 +- .../src/context-providers/default.ts | 13 +++-- .../src/context-providers/matrix.test.ts | 56 ++++++++++++++----- .../src/context-providers/matrix.ts | 17 ++++-- 5 files changed, 64 insertions(+), 26 deletions(-) diff --git a/actions-languageservice/src/complete.expressions.test.ts b/actions-languageservice/src/complete.expressions.test.ts index e8a4715..7a2d345 100644 --- a/actions-languageservice/src/complete.expressions.test.ts +++ b/actions-languageservice/src/complete.expressions.test.ts @@ -532,7 +532,7 @@ jobs: const result = await complete(...getPositionFromCursor(input), undefined, contextProviderConfig); - expect(result.map(x => x.label)).toEqual([]); + expect(result.map(x => x.label)).toEqual(["animal", "fruit"]); }); it("matrix with expression in property", async () => { diff --git a/actions-languageservice/src/complete.ts b/actions-languageservice/src/complete.ts index db85d6c..0def058 100644 --- a/actions-languageservice/src/complete.ts +++ b/actions-languageservice/src/complete.ts @@ -85,7 +85,7 @@ export async function complete( const expressionInput = (getExpressionInput(currentInput, relCharPos) || "").trim(); const allowedContext = getAllowedContext(token, parent); - const context = await getContext(allowedContext, contextProviderConfig, workflowContext); + const context = await getContext(allowedContext, contextProviderConfig, workflowContext, true); return completeExpression(expressionInput, context, []); } diff --git a/actions-languageservice/src/context-providers/default.ts b/actions-languageservice/src/context-providers/default.ts index 784c693..2c0f35f 100644 --- a/actions-languageservice/src/context-providers/default.ts +++ b/actions-languageservice/src/context-providers/default.ts @@ -15,13 +15,14 @@ export type ContextValue = data.Dictionary | data.Null; export async function getContext( names: string[], config: ContextProviderConfig | undefined, - workflowContext: WorkflowContext + workflowContext: WorkflowContext, + allowPartialContext: boolean = false ): Promise { const context = new data.Dictionary(); const filteredNames = filterContextNames(names, workflowContext); for (const contextName of filteredNames) { - let value = (await getDefaultContext(contextName, workflowContext)) || new data.Dictionary(); + let value = getDefaultContext(contextName, workflowContext, allowPartialContext) || new data.Dictionary(); if (value.kind === Kind.Null) { context.add(contextName, value); continue; @@ -35,7 +36,11 @@ export async function getContext( return context; } -async function getDefaultContext(name: string, workflowContext: WorkflowContext): Promise { +function getDefaultContext( + name: string, + workflowContext: WorkflowContext, + allowPartialContext: boolean +): ContextValue | undefined { switch (name) { case "runner": return objectToDictionary({ @@ -62,7 +67,7 @@ async function getDefaultContext(name: string, workflowContext: WorkflowContext) return getStrategyContext(workflowContext); case "matrix": - return getMatrixContext(workflowContext); + return getMatrixContext(workflowContext, allowPartialContext); } return undefined; diff --git a/actions-languageservice/src/context-providers/matrix.test.ts b/actions-languageservice/src/context-providers/matrix.test.ts index a1e473c..5f00477 100644 --- a/actions-languageservice/src/context-providers/matrix.test.ts +++ b/actions-languageservice/src/context-providers/matrix.test.ts @@ -62,7 +62,7 @@ describe("matrix context", () => { const workflowContext = {} as WorkflowContext; expect(workflowContext.job).toBeUndefined(); - const context = getMatrixContext(workflowContext); + const context = getMatrixContext(workflowContext, false); expect(context).toEqual(new data.Dictionary()); }); @@ -71,7 +71,7 @@ describe("matrix context", () => { const workflowContext = {job} as WorkflowContext; expect(workflowContext.job!.strategy).toBeUndefined(); - const context = getMatrixContext(workflowContext); + const context = getMatrixContext(workflowContext, false); expect(context).toEqual(new data.Dictionary()); }); @@ -79,7 +79,7 @@ describe("matrix context", () => { const workflowContext = contextFromStrategy(stringToToken("hello")); expect(workflowContext.job!.strategy).toBeDefined(); - const context = getMatrixContext(workflowContext); + const context = getMatrixContext(workflowContext, false); expect(context).toEqual(new data.Dictionary()); }); @@ -87,7 +87,7 @@ describe("matrix context", () => { const strategy = new MappingToken(undefined, undefined, undefined); const workflowContext = contextFromStrategy(strategy); - const context = getMatrixContext(workflowContext); + const context = getMatrixContext(workflowContext, false); expect(context).toEqual(new data.Null()); }); @@ -96,7 +96,7 @@ describe("matrix context", () => { strategy.add(stringToToken("matrix"), stringToToken("hello")); const workflowContext = contextFromStrategy(strategy); - const context = getMatrixContext(workflowContext); + const context = getMatrixContext(workflowContext, false); expect(context).toEqual(new data.Null()); }); @@ -105,7 +105,7 @@ describe("matrix context", () => { strategy.add(stringToToken("matrix"), new MappingToken(undefined, undefined, undefined)); const workflowContext = contextFromStrategy(strategy); - const context = getMatrixContext(workflowContext); + const context = getMatrixContext(workflowContext, false); expect(context).toEqual(new data.Dictionary()); }); }); @@ -116,7 +116,7 @@ describe("matrix context", () => { strategy.add(stringToToken("matrix"), expressionToToken("${{ fromJSON(needs.job1.outputs.matrix) }}")); const workflowContext = contextFromStrategy(strategy); - const context = getMatrixContext(workflowContext); + const context = getMatrixContext(workflowContext, false); expect(context).toEqual(new data.Null()); }); @@ -136,11 +136,37 @@ describe("matrix context", () => { strategy.add(stringToToken("matrix"), matrix); const workflowContext = contextFromStrategy(strategy); - const context = getMatrixContext(workflowContext); + const context = getMatrixContext(workflowContext, false); expect(context).toEqual(new data.Null()); }); + it("matrix with include expression and partial context allowed", () => { + const include = expressionToToken("${{ fromJSON(needs.job1.outputs.matrix) }}"); + + const nodeSequence = new SequenceToken(undefined, undefined, undefined); + nodeSequence.add(stringToToken("12")); + nodeSequence.add(stringToToken("14")); + + const matrix = new MappingToken(undefined, undefined, undefined); + matrix.add(stringToToken("node"), nodeSequence); + matrix.add(stringToToken("include"), include); + + const strategy = new MappingToken(undefined, undefined, undefined); + strategy.add(stringToToken("matrix"), matrix); + + const workflowContext = contextFromStrategy(strategy); + + const context = getMatrixContext(workflowContext, true); + + expect(context).toEqual( + new data.Dictionary({ + key: "node", + value: new data.Array(new data.StringData("12"), new data.StringData("14")) + }) + ); + }); + it("matrix with expression within property", () => { const version = expressionToToken("${{ github.event.client_payload.versions }}"); @@ -151,7 +177,7 @@ describe("matrix context", () => { strategy.add(stringToToken("matrix"), matrix); const workflowContext = contextFromStrategy(strategy); - const context = getMatrixContext(workflowContext); + const context = getMatrixContext(workflowContext, false); expect(context).toEqual( new data.Dictionary({ @@ -166,7 +192,7 @@ describe("matrix context", () => { it("basic matrix", () => { const workflowContext = createMatrix({os: ["ubuntu-latest", "windows-latest"]}); - const context = getMatrixContext(workflowContext); + const context = getMatrixContext(workflowContext, false); expect(context).toEqual( new data.Dictionary({ key: "os", @@ -181,7 +207,7 @@ describe("matrix context", () => { node: ["12", "14"] }); - const context = getMatrixContext(workflowContext); + const context = getMatrixContext(workflowContext, false); expect(context).toEqual( new data.Dictionary( { @@ -208,7 +234,7 @@ describe("matrix context", () => { ] }); - const context = getMatrixContext(workflowContext); + const context = getMatrixContext(workflowContext, false); expect(context).toEqual( new data.Dictionary( @@ -242,7 +268,7 @@ describe("matrix context", () => { ] }); - const context = getMatrixContext(workflowContext); + const context = getMatrixContext(workflowContext, false); expect(context).toEqual( new data.Dictionary( @@ -276,7 +302,7 @@ describe("matrix context", () => { ] }); - const context = getMatrixContext(workflowContext); + const context = getMatrixContext(workflowContext, false); expect(context).toEqual( new data.Dictionary( @@ -311,7 +337,7 @@ describe("matrix context", () => { ] }); - const context = getMatrixContext(workflowContext); + const context = getMatrixContext(workflowContext, false); expect(context).toEqual(new data.Dictionary()); }); diff --git a/actions-languageservice/src/context-providers/matrix.ts b/actions-languageservice/src/context-providers/matrix.ts index f3d8b4c..5b65b10 100644 --- a/actions-languageservice/src/context-providers/matrix.ts +++ b/actions-languageservice/src/context-providers/matrix.ts @@ -6,7 +6,7 @@ import {SequenceToken} from "@github/actions-workflow-parser/templates/tokens/se import {WorkflowContext} from "../context/workflow-context"; import {ContextValue} from "./default"; -export function getMatrixContext(workflowContext: WorkflowContext): ContextValue { +export function getMatrixContext(workflowContext: WorkflowContext, allowPartialContext: boolean): ContextValue { // https://docs.github.com/en/actions/learn-github-actions/contexts#matrix-context const strategy = workflowContext.job?.strategy; if (!strategy || !isMapping(strategy)) { @@ -19,7 +19,7 @@ export function getMatrixContext(workflowContext: WorkflowContext): ContextValue return new data.Null(); } - const properties = matrixProperties(matrix); + const properties = matrixProperties(matrix, allowPartialContext); if (!properties) { // Matrix included an expression, so there's no context we can provide return new data.Null(); @@ -94,7 +94,10 @@ export function getMatrixContext(workflowContext: WorkflowContext): ContextValue * * Keys: os, version, environment */ -function matrixProperties(matrix: MappingToken): Map | undefined> | undefined { +function matrixProperties( + matrix: MappingToken, + allowPartialContext: boolean +): Map | undefined> | undefined { const properties = new Map | undefined>(); let include: SequenceToken | undefined; @@ -108,9 +111,13 @@ function matrixProperties(matrix: MappingToken): Map | undef const key = pair.key.value; switch (key) { case "include": - // If "include" is an expression, we can't know the properties of the matrix + // If "include" is an expression, we can't know the full properties of the matrix if (isBasicExpression(pair.value) || !isSequence(pair.value)) { - return; + if (!allowPartialContext) { + return; + } else { + continue; + } } include = pair.value; break; From 1a18864ba61126e4713ba38d66e3557f0a8d5860 Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 9 Dec 2022 14:50:14 +0000 Subject: [PATCH 06/18] v0.1.42 --- actions-languageserver/package.json | 4 ++-- actions-languageservice/package.json | 2 +- browser-playground/package.json | 4 ++-- lerna.json | 2 +- package-lock.json | 14 +++++++------- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/actions-languageserver/package.json b/actions-languageserver/package.json index 3d7a309..7b33fe0 100644 --- a/actions-languageserver/package.json +++ b/actions-languageserver/package.json @@ -1,6 +1,6 @@ { "name": "@github/actions-languageserver", - "version": "0.1.41", + "version": "0.1.42", "description": "Language server for GitHub Actions", "license": "MIT", "type": "module", @@ -38,7 +38,7 @@ "prettier-fix": "prettier --write ." }, "dependencies": { - "@github/actions-languageservice": "^0.1.41", + "@github/actions-languageservice": "^0.1.42", "@octokit/rest": "^19.0.5", "vscode-languageserver": "^8.0.2", "vscode-languageserver-textdocument": "^1.0.7" diff --git a/actions-languageservice/package.json b/actions-languageservice/package.json index ad21262..3fd4db5 100644 --- a/actions-languageservice/package.json +++ b/actions-languageservice/package.json @@ -1,6 +1,6 @@ { "name": "@github/actions-languageservice", - "version": "0.1.41", + "version": "0.1.42", "description": "Language service for GitHub Actions", "license": "MIT", "type": "module", diff --git a/browser-playground/package.json b/browser-playground/package.json index ce36637..2a1f388 100644 --- a/browser-playground/package.json +++ b/browser-playground/package.json @@ -1,12 +1,12 @@ { "name": "browser-playground", - "version": "0.1.41", + "version": "0.1.42", "description": "", "private": true, "main": "index.js", "type": "module", "dependencies": { - "@github/actions-languageserver": "^0.1.41", + "@github/actions-languageserver": "^0.1.42", "monaco-editor-webpack-plugin": "^7.0.1", "monaco-editor-workers": "^0.34.2", "monaco-languageclient": "^4.0.3", diff --git a/lerna.json b/lerna.json index 0483e2f..25ed588 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", "useWorkspaces": true, - "version": "0.1.41" + "version": "0.1.42" } diff --git a/package-lock.json b/package-lock.json index 18ee009..e5836fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,10 +16,10 @@ }, "actions-languageserver": { "name": "@github/actions-languageserver", - "version": "0.1.41", + "version": "0.1.42", "license": "MIT", "dependencies": { - "@github/actions-languageservice": "^0.1.41", + "@github/actions-languageservice": "^0.1.42", "@octokit/rest": "^19.0.5", "vscode-languageserver": "^8.0.2", "vscode-languageserver-textdocument": "^1.0.7" @@ -38,7 +38,7 @@ }, "actions-languageservice": { "name": "@github/actions-languageservice", - "version": "0.1.41", + "version": "0.1.42", "license": "MIT", "dependencies": { "@github/actions-workflow-parser": "*", @@ -59,10 +59,10 @@ } }, "browser-playground": { - "version": "0.1.41", + "version": "0.1.42", "license": "MIT", "dependencies": { - "@github/actions-languageserver": "^0.1.41", + "@github/actions-languageserver": "^0.1.42", "monaco-editor-webpack-plugin": "^7.0.1", "monaco-editor-workers": "^0.34.2", "monaco-languageclient": "^4.0.3", @@ -13505,7 +13505,7 @@ "@github/actions-languageserver": { "version": "file:actions-languageserver", "requires": { - "@github/actions-languageservice": "^0.1.41", + "@github/actions-languageservice": "^0.1.42", "@octokit/rest": "^19.0.5", "@types/jest": "^29.0.3", "jest": "^29.0.3", @@ -16288,7 +16288,7 @@ "browser-playground": { "version": "file:browser-playground", "requires": { - "@github/actions-languageserver": "^0.1.41", + "@github/actions-languageserver": "^0.1.42", "css-loader": "^6.7.2", "monaco-editor-webpack-plugin": "^7.0.1", "monaco-editor-workers": "^0.34.2", From cb0bee35fecb674e408cd904a0d7b69bb1cb9763 Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Fri, 9 Dec 2022 10:40:19 -0500 Subject: [PATCH 07/18] Replace `allowPartialContext` with a mode enum --- actions-languageservice/src/complete.ts | 4 +-- .../src/context-providers/default.ts | 18 +++++----- .../src/context-providers/matrix.test.ts | 35 ++++++++++--------- .../src/context-providers/matrix.ts | 14 ++++---- actions-languageservice/src/validate.ts | 5 ++- 5 files changed, 38 insertions(+), 38 deletions(-) diff --git a/actions-languageservice/src/complete.ts b/actions-languageservice/src/complete.ts index 0def058..067680c 100644 --- a/actions-languageservice/src/complete.ts +++ b/actions-languageservice/src/complete.ts @@ -11,7 +11,7 @@ import {File} from "@github/actions-workflow-parser/workflows/file"; import {Position, TextDocument} from "vscode-languageserver-textdocument"; import {CompletionItem, TextEdit, Range} from "vscode-languageserver-types"; import {ContextProviderConfig} from "./context-providers/config"; -import {getContext} from "./context-providers/default"; +import {getContext, Mode} from "./context-providers/default"; import {getWorkflowContext, WorkflowContext} from "./context/workflow-context"; import {nullTrace} from "./nulltrace"; import {getAllowedContext} from "./utils/allowed-context"; @@ -85,7 +85,7 @@ export async function complete( const expressionInput = (getExpressionInput(currentInput, relCharPos) || "").trim(); const allowedContext = getAllowedContext(token, parent); - const context = await getContext(allowedContext, contextProviderConfig, workflowContext, true); + const context = await getContext(allowedContext, contextProviderConfig, workflowContext, Mode.Completion); return completeExpression(expressionInput, context, []); } diff --git a/actions-languageservice/src/context-providers/default.ts b/actions-languageservice/src/context-providers/default.ts index 2c0f35f..ba83a74 100644 --- a/actions-languageservice/src/context-providers/default.ts +++ b/actions-languageservice/src/context-providers/default.ts @@ -12,17 +12,23 @@ import {getStrategyContext} from "./strategy"; // Null indicates that the context provider doesn't have any value to provide export type ContextValue = data.Dictionary | data.Null; +export enum Mode { + Completion, + Validation, + Hover +} + export async function getContext( names: string[], config: ContextProviderConfig | undefined, workflowContext: WorkflowContext, - allowPartialContext: boolean = false + mode: Mode ): Promise { const context = new data.Dictionary(); const filteredNames = filterContextNames(names, workflowContext); for (const contextName of filteredNames) { - let value = getDefaultContext(contextName, workflowContext, allowPartialContext) || new data.Dictionary(); + let value = getDefaultContext(contextName, workflowContext, mode) || new data.Dictionary(); if (value.kind === Kind.Null) { context.add(contextName, value); continue; @@ -36,11 +42,7 @@ export async function getContext( return context; } -function getDefaultContext( - name: string, - workflowContext: WorkflowContext, - allowPartialContext: boolean -): ContextValue | undefined { +function getDefaultContext(name: string, workflowContext: WorkflowContext, mode: Mode): ContextValue | undefined { switch (name) { case "runner": return objectToDictionary({ @@ -67,7 +69,7 @@ function getDefaultContext( return getStrategyContext(workflowContext); case "matrix": - return getMatrixContext(workflowContext, allowPartialContext); + return getMatrixContext(workflowContext, mode); } return undefined; diff --git a/actions-languageservice/src/context-providers/matrix.test.ts b/actions-languageservice/src/context-providers/matrix.test.ts index 5f00477..0aa68cb 100644 --- a/actions-languageservice/src/context-providers/matrix.test.ts +++ b/actions-languageservice/src/context-providers/matrix.test.ts @@ -7,6 +7,7 @@ import {SequenceToken} from "@github/actions-workflow-parser/templates/tokens/se import {StringToken} from "@github/actions-workflow-parser/templates/tokens/string-token"; import {TemplateToken} from "@github/actions-workflow-parser/templates/tokens/template-token"; import {WorkflowContext} from "../context/workflow-context"; +import {Mode} from "./default"; import {getMatrixContext} from "./matrix"; type MatrixMap = { @@ -62,7 +63,7 @@ describe("matrix context", () => { const workflowContext = {} as WorkflowContext; expect(workflowContext.job).toBeUndefined(); - const context = getMatrixContext(workflowContext, false); + const context = getMatrixContext(workflowContext, Mode.Validation); expect(context).toEqual(new data.Dictionary()); }); @@ -71,7 +72,7 @@ describe("matrix context", () => { const workflowContext = {job} as WorkflowContext; expect(workflowContext.job!.strategy).toBeUndefined(); - const context = getMatrixContext(workflowContext, false); + const context = getMatrixContext(workflowContext, Mode.Validation); expect(context).toEqual(new data.Dictionary()); }); @@ -79,7 +80,7 @@ describe("matrix context", () => { const workflowContext = contextFromStrategy(stringToToken("hello")); expect(workflowContext.job!.strategy).toBeDefined(); - const context = getMatrixContext(workflowContext, false); + const context = getMatrixContext(workflowContext, Mode.Validation); expect(context).toEqual(new data.Dictionary()); }); @@ -87,7 +88,7 @@ describe("matrix context", () => { const strategy = new MappingToken(undefined, undefined, undefined); const workflowContext = contextFromStrategy(strategy); - const context = getMatrixContext(workflowContext, false); + const context = getMatrixContext(workflowContext, Mode.Validation); expect(context).toEqual(new data.Null()); }); @@ -96,7 +97,7 @@ describe("matrix context", () => { strategy.add(stringToToken("matrix"), stringToToken("hello")); const workflowContext = contextFromStrategy(strategy); - const context = getMatrixContext(workflowContext, false); + const context = getMatrixContext(workflowContext, Mode.Validation); expect(context).toEqual(new data.Null()); }); @@ -105,7 +106,7 @@ describe("matrix context", () => { strategy.add(stringToToken("matrix"), new MappingToken(undefined, undefined, undefined)); const workflowContext = contextFromStrategy(strategy); - const context = getMatrixContext(workflowContext, false); + const context = getMatrixContext(workflowContext, Mode.Validation); expect(context).toEqual(new data.Dictionary()); }); }); @@ -116,7 +117,7 @@ describe("matrix context", () => { strategy.add(stringToToken("matrix"), expressionToToken("${{ fromJSON(needs.job1.outputs.matrix) }}")); const workflowContext = contextFromStrategy(strategy); - const context = getMatrixContext(workflowContext, false); + const context = getMatrixContext(workflowContext, Mode.Validation); expect(context).toEqual(new data.Null()); }); @@ -136,12 +137,12 @@ describe("matrix context", () => { strategy.add(stringToToken("matrix"), matrix); const workflowContext = contextFromStrategy(strategy); - const context = getMatrixContext(workflowContext, false); + const context = getMatrixContext(workflowContext, Mode.Validation); expect(context).toEqual(new data.Null()); }); - it("matrix with include expression and partial context allowed", () => { + it("matrix with include expression during completion", () => { const include = expressionToToken("${{ fromJSON(needs.job1.outputs.matrix) }}"); const nodeSequence = new SequenceToken(undefined, undefined, undefined); @@ -157,7 +158,7 @@ describe("matrix context", () => { const workflowContext = contextFromStrategy(strategy); - const context = getMatrixContext(workflowContext, true); + const context = getMatrixContext(workflowContext, Mode.Completion); expect(context).toEqual( new data.Dictionary({ @@ -177,7 +178,7 @@ describe("matrix context", () => { strategy.add(stringToToken("matrix"), matrix); const workflowContext = contextFromStrategy(strategy); - const context = getMatrixContext(workflowContext, false); + const context = getMatrixContext(workflowContext, Mode.Validation); expect(context).toEqual( new data.Dictionary({ @@ -192,7 +193,7 @@ describe("matrix context", () => { it("basic matrix", () => { const workflowContext = createMatrix({os: ["ubuntu-latest", "windows-latest"]}); - const context = getMatrixContext(workflowContext, false); + const context = getMatrixContext(workflowContext, Mode.Validation); expect(context).toEqual( new data.Dictionary({ key: "os", @@ -207,7 +208,7 @@ describe("matrix context", () => { node: ["12", "14"] }); - const context = getMatrixContext(workflowContext, false); + const context = getMatrixContext(workflowContext, Mode.Validation); expect(context).toEqual( new data.Dictionary( { @@ -234,7 +235,7 @@ describe("matrix context", () => { ] }); - const context = getMatrixContext(workflowContext, false); + const context = getMatrixContext(workflowContext, Mode.Validation); expect(context).toEqual( new data.Dictionary( @@ -268,7 +269,7 @@ describe("matrix context", () => { ] }); - const context = getMatrixContext(workflowContext, false); + const context = getMatrixContext(workflowContext, Mode.Validation); expect(context).toEqual( new data.Dictionary( @@ -302,7 +303,7 @@ describe("matrix context", () => { ] }); - const context = getMatrixContext(workflowContext, false); + const context = getMatrixContext(workflowContext, Mode.Validation); expect(context).toEqual( new data.Dictionary( @@ -337,7 +338,7 @@ describe("matrix context", () => { ] }); - const context = getMatrixContext(workflowContext, false); + const context = getMatrixContext(workflowContext, Mode.Validation); expect(context).toEqual(new data.Dictionary()); }); diff --git a/actions-languageservice/src/context-providers/matrix.ts b/actions-languageservice/src/context-providers/matrix.ts index 5b65b10..a306929 100644 --- a/actions-languageservice/src/context-providers/matrix.ts +++ b/actions-languageservice/src/context-providers/matrix.ts @@ -4,9 +4,9 @@ import {KeyValuePair} from "@github/actions-workflow-parser/templates/tokens/key import {MappingToken} from "@github/actions-workflow-parser/templates/tokens/mapping-token"; import {SequenceToken} from "@github/actions-workflow-parser/templates/tokens/sequence-token"; import {WorkflowContext} from "../context/workflow-context"; -import {ContextValue} from "./default"; +import {ContextValue, Mode} from "./default"; -export function getMatrixContext(workflowContext: WorkflowContext, allowPartialContext: boolean): ContextValue { +export function getMatrixContext(workflowContext: WorkflowContext, mode: Mode): ContextValue { // https://docs.github.com/en/actions/learn-github-actions/contexts#matrix-context const strategy = workflowContext.job?.strategy; if (!strategy || !isMapping(strategy)) { @@ -19,7 +19,7 @@ export function getMatrixContext(workflowContext: WorkflowContext, allowPartialC return new data.Null(); } - const properties = matrixProperties(matrix, allowPartialContext); + const properties = matrixProperties(matrix, mode); if (!properties) { // Matrix included an expression, so there's no context we can provide return new data.Null(); @@ -94,10 +94,7 @@ export function getMatrixContext(workflowContext: WorkflowContext, allowPartialC * * Keys: os, version, environment */ -function matrixProperties( - matrix: MappingToken, - allowPartialContext: boolean -): Map | undefined> | undefined { +function matrixProperties(matrix: MappingToken, mode: Mode): Map | undefined> | undefined { const properties = new Map | undefined>(); let include: SequenceToken | undefined; @@ -113,7 +110,8 @@ function matrixProperties( case "include": // If "include" is an expression, we can't know the full properties of the matrix if (isBasicExpression(pair.value) || !isSequence(pair.value)) { - if (!allowPartialContext) { + // Without the full properties of the matrix, we shouldn't validate anything + if (mode === Mode.Validation) { return; } else { continue; diff --git a/actions-languageservice/src/validate.ts b/actions-languageservice/src/validate.ts index 99962c9..8d2938e 100644 --- a/actions-languageservice/src/validate.ts +++ b/actions-languageservice/src/validate.ts @@ -10,7 +10,6 @@ import { } from "@github/actions-workflow-parser"; import {ErrorPolicy} from "@github/actions-workflow-parser/model/convert"; import {splitAllowedContext} from "@github/actions-workflow-parser/templates/allowed-context"; -import {Definition} from "@github/actions-workflow-parser/templates/schema/definition"; import {BasicExpressionToken} from "@github/actions-workflow-parser/templates/tokens/basic-expression-token"; import {StringToken} from "@github/actions-workflow-parser/templates/tokens/string-token"; import {TemplateToken} from "@github/actions-workflow-parser/templates/tokens/template-token"; @@ -19,7 +18,7 @@ import {TextDocument} from "vscode-languageserver-textdocument"; import {Diagnostic, DiagnosticSeverity, URI} from "vscode-languageserver-types"; import {ContextProviderConfig} from "./context-providers/config"; -import {getContext} from "./context-providers/default"; +import {getContext, Mode} from "./context-providers/default"; import {getWorkflowContext, WorkflowContext} from "./context/workflow-context"; import {AccessError, wrapDictionary} from "./expression-validation/error-dictionary"; import {error} from "./log"; @@ -196,7 +195,7 @@ async function validateExpression( } try { - const context = await getContext(namedContexts, contextProviderConfig, workflowContext); + const context = await getContext(namedContexts, contextProviderConfig, workflowContext, Mode.Validation); const e = new Evaluator(expr, wrapDictionary(context)); e.evaluate(); From 1af3f0b6728a438be961c9a387e1253d53cfd643 Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 9 Dec 2022 15:45:58 +0000 Subject: [PATCH 08/18] v0.1.43 --- actions-languageserver/package.json | 4 ++-- actions-languageservice/package.json | 2 +- browser-playground/package.json | 4 ++-- lerna.json | 2 +- package-lock.json | 14 +++++++------- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/actions-languageserver/package.json b/actions-languageserver/package.json index 7b33fe0..4a3ccbd 100644 --- a/actions-languageserver/package.json +++ b/actions-languageserver/package.json @@ -1,6 +1,6 @@ { "name": "@github/actions-languageserver", - "version": "0.1.42", + "version": "0.1.43", "description": "Language server for GitHub Actions", "license": "MIT", "type": "module", @@ -38,7 +38,7 @@ "prettier-fix": "prettier --write ." }, "dependencies": { - "@github/actions-languageservice": "^0.1.42", + "@github/actions-languageservice": "^0.1.43", "@octokit/rest": "^19.0.5", "vscode-languageserver": "^8.0.2", "vscode-languageserver-textdocument": "^1.0.7" diff --git a/actions-languageservice/package.json b/actions-languageservice/package.json index 3fd4db5..99493ca 100644 --- a/actions-languageservice/package.json +++ b/actions-languageservice/package.json @@ -1,6 +1,6 @@ { "name": "@github/actions-languageservice", - "version": "0.1.42", + "version": "0.1.43", "description": "Language service for GitHub Actions", "license": "MIT", "type": "module", diff --git a/browser-playground/package.json b/browser-playground/package.json index 2a1f388..79da1ea 100644 --- a/browser-playground/package.json +++ b/browser-playground/package.json @@ -1,12 +1,12 @@ { "name": "browser-playground", - "version": "0.1.42", + "version": "0.1.43", "description": "", "private": true, "main": "index.js", "type": "module", "dependencies": { - "@github/actions-languageserver": "^0.1.42", + "@github/actions-languageserver": "^0.1.43", "monaco-editor-webpack-plugin": "^7.0.1", "monaco-editor-workers": "^0.34.2", "monaco-languageclient": "^4.0.3", diff --git a/lerna.json b/lerna.json index 25ed588..9a2d6a8 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", "useWorkspaces": true, - "version": "0.1.42" + "version": "0.1.43" } diff --git a/package-lock.json b/package-lock.json index e5836fd..7366b86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,10 +16,10 @@ }, "actions-languageserver": { "name": "@github/actions-languageserver", - "version": "0.1.42", + "version": "0.1.43", "license": "MIT", "dependencies": { - "@github/actions-languageservice": "^0.1.42", + "@github/actions-languageservice": "^0.1.43", "@octokit/rest": "^19.0.5", "vscode-languageserver": "^8.0.2", "vscode-languageserver-textdocument": "^1.0.7" @@ -38,7 +38,7 @@ }, "actions-languageservice": { "name": "@github/actions-languageservice", - "version": "0.1.42", + "version": "0.1.43", "license": "MIT", "dependencies": { "@github/actions-workflow-parser": "*", @@ -59,10 +59,10 @@ } }, "browser-playground": { - "version": "0.1.42", + "version": "0.1.43", "license": "MIT", "dependencies": { - "@github/actions-languageserver": "^0.1.42", + "@github/actions-languageserver": "^0.1.43", "monaco-editor-webpack-plugin": "^7.0.1", "monaco-editor-workers": "^0.34.2", "monaco-languageclient": "^4.0.3", @@ -13505,7 +13505,7 @@ "@github/actions-languageserver": { "version": "file:actions-languageserver", "requires": { - "@github/actions-languageservice": "^0.1.42", + "@github/actions-languageservice": "^0.1.43", "@octokit/rest": "^19.0.5", "@types/jest": "^29.0.3", "jest": "^29.0.3", @@ -16288,7 +16288,7 @@ "browser-playground": { "version": "file:browser-playground", "requires": { - "@github/actions-languageserver": "^0.1.42", + "@github/actions-languageserver": "^0.1.43", "css-loader": "^6.7.2", "monaco-editor-webpack-plugin": "^7.0.1", "monaco-editor-workers": "^0.34.2", From efe71dd684866c21156bfa84235b0a4d67cb22c8 Mon Sep 17 00:00:00 2001 From: Christopher Schleiden Date: Thu, 8 Dec 2022 16:38:36 -0800 Subject: [PATCH 09/18] Auto completion for multi-line expressions --- .../src/complete.expressions.test.ts | 58 +++++++++++++++++++ actions-languageservice/src/complete.ts | 14 ++++- .../src/test-utils/cursor-position.ts | 22 +++++-- 3 files changed, 86 insertions(+), 8 deletions(-) diff --git a/actions-languageservice/src/complete.expressions.test.ts b/actions-languageservice/src/complete.expressions.test.ts index 7a2d345..a32c9dd 100644 --- a/actions-languageservice/src/complete.expressions.test.ts +++ b/actions-languageservice/src/complete.expressions.test.ts @@ -88,6 +88,64 @@ describe("expressions", () => { ]); }); + describe("multi-line strings", () => { + it("indented |", async () => { + const input = `on: push +jobs: + build: + steps: + - run: | + first line + test \${{ github.| }} + test2`; + const result = await complete(...getPositionFromCursor(input, 1), undefined, contextProviderConfig); + + expect(result.map(x => x.label)).toEqual(["event"]); + }); + + it("indented |+", async () => { + const input = `on: push +jobs: + build: + steps: + - run: |+ + first line + test \${{ github.| }} + test2`; + const result = await complete(...getPositionFromCursor(input, 1), undefined, contextProviderConfig); + + expect(result.map(x => x.label)).toEqual(["event"]); + }); + + it("indented >", async () => { + const input = `on: push +jobs: + build: + steps: + - run: > + first line + test \${{ github.| }} + test2`; + const result = await complete(...getPositionFromCursor(input), undefined, contextProviderConfig); + + expect(result.map(x => x.label)).toEqual(["event"]); + }); + + it("indented >+", async () => { + const input = `on: push +jobs: + build: + steps: + - run: >+ + first line + test \${{ github.| }} + test2`; + const result = await complete(...getPositionFromCursor(input), undefined, contextProviderConfig); + + expect(result.map(x => x.label)).toEqual(["event"]); + }); + }); + it("nested auto-complete", async () => { const input = "run-name: ${{ github.| }}"; const result = await complete(...getPositionFromCursor(input), undefined, contextProviderConfig); diff --git a/actions-languageservice/src/complete.ts b/actions-languageservice/src/complete.ts index 067680c..5ecf738 100644 --- a/actions-languageservice/src/complete.ts +++ b/actions-languageservice/src/complete.ts @@ -9,7 +9,7 @@ import {MappingToken} from "@github/actions-workflow-parser/templates/tokens/map import {TokenType} from "@github/actions-workflow-parser/templates/tokens/types"; import {File} from "@github/actions-workflow-parser/workflows/file"; import {Position, TextDocument} from "vscode-languageserver-textdocument"; -import {CompletionItem, TextEdit, Range} from "vscode-languageserver-types"; +import {CompletionItem, Range, TextEdit} from "vscode-languageserver-types"; import {ContextProviderConfig} from "./context-providers/config"; import {getContext, Mode} from "./context-providers/default"; import {getWorkflowContext, WorkflowContext} from "./context/workflow-context"; @@ -77,10 +77,18 @@ export async function complete( token.definition?.definitionType === DefinitionType.String && (token.definition as StringDefinition).isExpression; const containsExpression = isString(token) && token.value.indexOf(OPEN_EXPRESSION) >= 0; if (isString(token) && (isExpression || containsExpression)) { - const currentInput = token.value; + const currentInput = token.source || token.value; // Transform the overall position into a node relative position - const relCharPos = newPos.character - token.range!.start[1]; + let relCharPos: number = 0; + const lineDiff = newPos.line - token.range!.start[0]; + if (token.range!.start[0] !== token.range!.end[0]) { + const lines = currentInput.split("\n"); + const linesBeforeCusor = lines.slice(0, lineDiff); + relCharPos = linesBeforeCusor.join("\n").length + newPos.character; + } else { + relCharPos = newPos.character - token.range!.start[1]; + } const expressionInput = (getExpressionInput(currentInput, relCharPos) || "").trim(); diff --git a/actions-languageservice/src/test-utils/cursor-position.ts b/actions-languageservice/src/test-utils/cursor-position.ts index 51d2ed4..c26c0e1 100644 --- a/actions-languageservice/src/test-utils/cursor-position.ts +++ b/actions-languageservice/src/test-utils/cursor-position.ts @@ -1,18 +1,30 @@ import {Position, TextDocument} from "vscode-languageserver-textdocument"; import {createDocument} from "./document"; -// Calculates the position of the cursor and the document without that cursor -// Cursor is represented by a `|` character -export function getPositionFromCursor(input: string): [TextDocument, Position] { +/** + * Calculates the position of the cursor and the document without that cursor + * Cursor is represented by a `|` character + * @param input Input string + * @param skip Instances of `|` to skip + */ +export function getPositionFromCursor(input: string, skip = 0): [TextDocument, Position] { const doc = createDocument("test.yaml", input); - const cursorIndex = doc.getText().indexOf("|"); + let cursorIndex = doc.getText().indexOf("|"); + for (let i = 0; i < skip && cursorIndex !== -1; i++) { + cursorIndex = doc.getText().indexOf("|", cursorIndex + 1); + } + if (cursorIndex === -1) { throw new Error("No cursor found in document"); } + // Replace only the last occurence of | in string + let newText = doc.getText(); + newText = newText.substring(0, cursorIndex) + newText.substring(cursorIndex + 1); + const position = doc.positionAt(cursorIndex); - const newDoc = TextDocument.create(doc.uri, doc.languageId, doc.version, doc.getText().replace("|", "")); + const newDoc = TextDocument.create(doc.uri, doc.languageId, doc.version, newText); return [newDoc, position]; } From 189ffdcff87dd89e60443f10fcaa67124b3132f3 Mon Sep 17 00:00:00 2001 From: Christopher Schleiden Date: Fri, 9 Dec 2022 08:33:14 -0800 Subject: [PATCH 10/18] Consume newer parser --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7366b86..c0cee75 100644 --- a/package-lock.json +++ b/package-lock.json @@ -698,9 +698,9 @@ "link": true }, "node_modules/@github/actions-workflow-parser": { - "version": "0.0.29", - "resolved": "https://npm.pkg.github.com/download/@github/actions-workflow-parser/0.0.29/ecf3d1c9727e4f5f71e52863f456672b173b7096", - "integrity": "sha512-VJLRv+GHD0E7S9uUCH89jIIA3iMdKRcqhrKwKq5TE5u/6Lap5nj1Juy48tBoCFAog07lhuqyqgWjP6FHHyAvPg==", + "version": "0.0.31", + "resolved": "https://npm.pkg.github.com/download/@github/actions-workflow-parser/0.0.31/ebc46956b91ed1a8c45efd41a3256ae818722557", + "integrity": "sha512-3k+MBWG7Gn86aHeLdJTiYUTGm53npEelzleCbq/8Ir51xVkRINsyNe4HuGJizXxZ2WoTxAkLeZ6qpO1oCucSIg==", "license": "MIT", "dependencies": { "@github/actions-expressions": "*", @@ -13533,9 +13533,9 @@ } }, "@github/actions-workflow-parser": { - "version": "0.0.29", - "resolved": "https://npm.pkg.github.com/download/@github/actions-workflow-parser/0.0.29/ecf3d1c9727e4f5f71e52863f456672b173b7096", - "integrity": "sha512-VJLRv+GHD0E7S9uUCH89jIIA3iMdKRcqhrKwKq5TE5u/6Lap5nj1Juy48tBoCFAog07lhuqyqgWjP6FHHyAvPg==", + "version": "0.0.31", + "resolved": "https://npm.pkg.github.com/download/@github/actions-workflow-parser/0.0.31/ebc46956b91ed1a8c45efd41a3256ae818722557", + "integrity": "sha512-3k+MBWG7Gn86aHeLdJTiYUTGm53npEelzleCbq/8Ir51xVkRINsyNe4HuGJizXxZ2WoTxAkLeZ6qpO1oCucSIg==", "requires": { "@github/actions-expressions": "*", "yaml": "^2.0.0-8" From 86dd16bd1248b92a263f54cfd7d8492bfa581fd1 Mon Sep 17 00:00:00 2001 From: Christopher Schleiden Date: Fri, 9 Dec 2022 08:38:09 -0800 Subject: [PATCH 11/18] Add some more validation tests --- .../src/validate.expressions.test.ts | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/actions-languageservice/src/validate.expressions.test.ts b/actions-languageservice/src/validate.expressions.test.ts index 0039471..b914ec9 100644 --- a/actions-languageservice/src/validate.expressions.test.ts +++ b/actions-languageservice/src/validate.expressions.test.ts @@ -306,6 +306,128 @@ jobs: }); }); + describe("multi-line strings", () => { + it("indented |", async () => { + const input = `on: push +jobs: + build: + runs-on: ubuntu-latest + steps: + - run: | + first line + test \${{ github.does-not-exist }} + test2`; + const result = await validate(createDocument("wf.yaml", input)); + + expect(result).toEqual([ + { + message: "Context access might be invalid: does-not-exist", + range: { + end: { + character: 43, + line: 7 + }, + start: { + character: 15, + line: 7 + } + }, + severity: DiagnosticSeverity.Warning + } + ]); + }); + + it("indented |+", async () => { + const input = `on: push +jobs: + build: + runs-on: ubuntu-latest + steps: + - run: |+ + first line + test \${{ github.does-not-exist }} + test2`; + const result = await validate(createDocument("wf.yaml", input)); + + expect(result).toEqual([ + { + message: "Context access might be invalid: does-not-exist", + range: { + end: { + character: 43, + line: 7 + }, + start: { + character: 15, + line: 7 + } + }, + severity: DiagnosticSeverity.Warning + } + ]); + }); + + it("indented >", async () => { + const input = `on: push +jobs: + build: + runs-on: ubuntu-latest + steps: + - run: > + first line + test \${{ github.does-not-exist }} + test2`; + const result = await validate(createDocument("wf.yaml", input)); + + expect(result).toEqual([ + { + message: "Context access might be invalid: does-not-exist", + range: { + end: { + character: 43, + line: 7 + }, + start: { + character: 15, + line: 7 + } + }, + severity: DiagnosticSeverity.Warning + } + ]); + }); + + it("indented >+", async () => { + const input = `on: push +jobs: + build: + runs-on: ubuntu-latest + steps: + - run: >+ + first line + test \${{ github.does-not-exist }} + test2`; + const result = await validate(createDocument("wf.yaml", input)); + + expect(result).toEqual([ + { + message: "Context access might be invalid: does-not-exist", + range: { + end: { + character: 43, + line: 7 + }, + start: { + character: 15, + line: 7 + } + }, + severity: DiagnosticSeverity.Warning + } + ]); + }); + }); + describe("matrix context", () => { it("reference within a matrix job", async () => { const input = ` From 1651896890574b908f8671e22195463f0542c5b1 Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 9 Dec 2022 16:43:04 +0000 Subject: [PATCH 12/18] v0.1.44 --- actions-languageserver/package.json | 4 ++-- actions-languageservice/package.json | 2 +- browser-playground/package.json | 4 ++-- lerna.json | 2 +- package-lock.json | 14 +++++++------- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/actions-languageserver/package.json b/actions-languageserver/package.json index 4a3ccbd..c38cb3c 100644 --- a/actions-languageserver/package.json +++ b/actions-languageserver/package.json @@ -1,6 +1,6 @@ { "name": "@github/actions-languageserver", - "version": "0.1.43", + "version": "0.1.44", "description": "Language server for GitHub Actions", "license": "MIT", "type": "module", @@ -38,7 +38,7 @@ "prettier-fix": "prettier --write ." }, "dependencies": { - "@github/actions-languageservice": "^0.1.43", + "@github/actions-languageservice": "^0.1.44", "@octokit/rest": "^19.0.5", "vscode-languageserver": "^8.0.2", "vscode-languageserver-textdocument": "^1.0.7" diff --git a/actions-languageservice/package.json b/actions-languageservice/package.json index 99493ca..ab02e67 100644 --- a/actions-languageservice/package.json +++ b/actions-languageservice/package.json @@ -1,6 +1,6 @@ { "name": "@github/actions-languageservice", - "version": "0.1.43", + "version": "0.1.44", "description": "Language service for GitHub Actions", "license": "MIT", "type": "module", diff --git a/browser-playground/package.json b/browser-playground/package.json index 79da1ea..757896a 100644 --- a/browser-playground/package.json +++ b/browser-playground/package.json @@ -1,12 +1,12 @@ { "name": "browser-playground", - "version": "0.1.43", + "version": "0.1.44", "description": "", "private": true, "main": "index.js", "type": "module", "dependencies": { - "@github/actions-languageserver": "^0.1.43", + "@github/actions-languageserver": "^0.1.44", "monaco-editor-webpack-plugin": "^7.0.1", "monaco-editor-workers": "^0.34.2", "monaco-languageclient": "^4.0.3", diff --git a/lerna.json b/lerna.json index 9a2d6a8..85bc6e5 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", "useWorkspaces": true, - "version": "0.1.43" + "version": "0.1.44" } diff --git a/package-lock.json b/package-lock.json index c0cee75..4b13de5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,10 +16,10 @@ }, "actions-languageserver": { "name": "@github/actions-languageserver", - "version": "0.1.43", + "version": "0.1.44", "license": "MIT", "dependencies": { - "@github/actions-languageservice": "^0.1.43", + "@github/actions-languageservice": "^0.1.44", "@octokit/rest": "^19.0.5", "vscode-languageserver": "^8.0.2", "vscode-languageserver-textdocument": "^1.0.7" @@ -38,7 +38,7 @@ }, "actions-languageservice": { "name": "@github/actions-languageservice", - "version": "0.1.43", + "version": "0.1.44", "license": "MIT", "dependencies": { "@github/actions-workflow-parser": "*", @@ -59,10 +59,10 @@ } }, "browser-playground": { - "version": "0.1.43", + "version": "0.1.44", "license": "MIT", "dependencies": { - "@github/actions-languageserver": "^0.1.43", + "@github/actions-languageserver": "^0.1.44", "monaco-editor-webpack-plugin": "^7.0.1", "monaco-editor-workers": "^0.34.2", "monaco-languageclient": "^4.0.3", @@ -13505,7 +13505,7 @@ "@github/actions-languageserver": { "version": "file:actions-languageserver", "requires": { - "@github/actions-languageservice": "^0.1.43", + "@github/actions-languageservice": "^0.1.44", "@octokit/rest": "^19.0.5", "@types/jest": "^29.0.3", "jest": "^29.0.3", @@ -16288,7 +16288,7 @@ "browser-playground": { "version": "file:browser-playground", "requires": { - "@github/actions-languageserver": "^0.1.43", + "@github/actions-languageserver": "^0.1.44", "css-loader": "^6.7.2", "monaco-editor-webpack-plugin": "^7.0.1", "monaco-editor-workers": "^0.34.2", From 2435b7ac8098499e7256dc0f3ca61441819e74c2 Mon Sep 17 00:00:00 2001 From: Christopher Schleiden Date: Fri, 9 Dec 2022 12:01:44 -0800 Subject: [PATCH 13/18] Workflow to update dependencies --- .../workflows/update-github-dependencies.yml | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/update-github-dependencies.yml diff --git a/.github/workflows/update-github-dependencies.yml b/.github/workflows/update-github-dependencies.yml new file mode 100644 index 0000000..a108d41 --- /dev/null +++ b/.github/workflows/update-github-dependencies.yml @@ -0,0 +1,32 @@ +on: + workflow_dispatch: + + +jobs: + update: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: 'https://npm.pkg.github.com' + scope: '@github' + + - run: npm ci + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - run: | + npm update @github/actions-workflow-parser + working-directory: ./actions-languageservice + + - run: | + git config user.name github-actions + git config user.email github-actions@github.com + + - run: | + git add . + git commit -m "Update @github/actions-workflow-parser" + git push \ No newline at end of file From 6b2aedfe11042dd73e18f6a22044338ae67c5646 Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 9 Dec 2022 20:02:30 +0000 Subject: [PATCH 14/18] v0.1.45 --- actions-languageserver/package.json | 4 ++-- actions-languageservice/package.json | 2 +- browser-playground/package.json | 4 ++-- lerna.json | 2 +- package-lock.json | 14 +++++++------- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/actions-languageserver/package.json b/actions-languageserver/package.json index c38cb3c..d95225b 100644 --- a/actions-languageserver/package.json +++ b/actions-languageserver/package.json @@ -1,6 +1,6 @@ { "name": "@github/actions-languageserver", - "version": "0.1.44", + "version": "0.1.45", "description": "Language server for GitHub Actions", "license": "MIT", "type": "module", @@ -38,7 +38,7 @@ "prettier-fix": "prettier --write ." }, "dependencies": { - "@github/actions-languageservice": "^0.1.44", + "@github/actions-languageservice": "^0.1.45", "@octokit/rest": "^19.0.5", "vscode-languageserver": "^8.0.2", "vscode-languageserver-textdocument": "^1.0.7" diff --git a/actions-languageservice/package.json b/actions-languageservice/package.json index ab02e67..2b9ab27 100644 --- a/actions-languageservice/package.json +++ b/actions-languageservice/package.json @@ -1,6 +1,6 @@ { "name": "@github/actions-languageservice", - "version": "0.1.44", + "version": "0.1.45", "description": "Language service for GitHub Actions", "license": "MIT", "type": "module", diff --git a/browser-playground/package.json b/browser-playground/package.json index 757896a..decdce2 100644 --- a/browser-playground/package.json +++ b/browser-playground/package.json @@ -1,12 +1,12 @@ { "name": "browser-playground", - "version": "0.1.44", + "version": "0.1.45", "description": "", "private": true, "main": "index.js", "type": "module", "dependencies": { - "@github/actions-languageserver": "^0.1.44", + "@github/actions-languageserver": "^0.1.45", "monaco-editor-webpack-plugin": "^7.0.1", "monaco-editor-workers": "^0.34.2", "monaco-languageclient": "^4.0.3", diff --git a/lerna.json b/lerna.json index 85bc6e5..7ea63b5 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", "useWorkspaces": true, - "version": "0.1.44" + "version": "0.1.45" } diff --git a/package-lock.json b/package-lock.json index 4b13de5..e821f90 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,10 +16,10 @@ }, "actions-languageserver": { "name": "@github/actions-languageserver", - "version": "0.1.44", + "version": "0.1.45", "license": "MIT", "dependencies": { - "@github/actions-languageservice": "^0.1.44", + "@github/actions-languageservice": "^0.1.45", "@octokit/rest": "^19.0.5", "vscode-languageserver": "^8.0.2", "vscode-languageserver-textdocument": "^1.0.7" @@ -38,7 +38,7 @@ }, "actions-languageservice": { "name": "@github/actions-languageservice", - "version": "0.1.44", + "version": "0.1.45", "license": "MIT", "dependencies": { "@github/actions-workflow-parser": "*", @@ -59,10 +59,10 @@ } }, "browser-playground": { - "version": "0.1.44", + "version": "0.1.45", "license": "MIT", "dependencies": { - "@github/actions-languageserver": "^0.1.44", + "@github/actions-languageserver": "^0.1.45", "monaco-editor-webpack-plugin": "^7.0.1", "monaco-editor-workers": "^0.34.2", "monaco-languageclient": "^4.0.3", @@ -13505,7 +13505,7 @@ "@github/actions-languageserver": { "version": "file:actions-languageserver", "requires": { - "@github/actions-languageservice": "^0.1.44", + "@github/actions-languageservice": "^0.1.45", "@octokit/rest": "^19.0.5", "@types/jest": "^29.0.3", "jest": "^29.0.3", @@ -16288,7 +16288,7 @@ "browser-playground": { "version": "file:browser-playground", "requires": { - "@github/actions-languageserver": "^0.1.44", + "@github/actions-languageserver": "^0.1.45", "css-loader": "^6.7.2", "monaco-editor-webpack-plugin": "^7.0.1", "monaco-editor-workers": "^0.34.2", From 6f3452a6d08d36132e1817918b9b8c77e457754d Mon Sep 17 00:00:00 2001 From: Christopher Schleiden Date: Fri, 9 Dec 2022 12:03:03 -0800 Subject: [PATCH 15/18] Add workflow name --- .github/workflows/update-github-dependencies.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/update-github-dependencies.yml b/.github/workflows/update-github-dependencies.yml index a108d41..536526e 100644 --- a/.github/workflows/update-github-dependencies.yml +++ b/.github/workflows/update-github-dependencies.yml @@ -1,3 +1,5 @@ +name: Update @github dependencies + on: workflow_dispatch: @@ -21,6 +23,8 @@ jobs: - run: | npm update @github/actions-workflow-parser working-directory: ./actions-languageservice + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | git config user.name github-actions From 92c3b14e1070a842d87509c95b3c40f553b54df6 Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 9 Dec 2022 20:04:14 +0000 Subject: [PATCH 16/18] v0.1.46 --- actions-languageserver/package.json | 4 ++-- actions-languageservice/package.json | 2 +- browser-playground/package.json | 4 ++-- lerna.json | 2 +- package-lock.json | 14 +++++++------- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/actions-languageserver/package.json b/actions-languageserver/package.json index d95225b..587a0d9 100644 --- a/actions-languageserver/package.json +++ b/actions-languageserver/package.json @@ -1,6 +1,6 @@ { "name": "@github/actions-languageserver", - "version": "0.1.45", + "version": "0.1.46", "description": "Language server for GitHub Actions", "license": "MIT", "type": "module", @@ -38,7 +38,7 @@ "prettier-fix": "prettier --write ." }, "dependencies": { - "@github/actions-languageservice": "^0.1.45", + "@github/actions-languageservice": "^0.1.46", "@octokit/rest": "^19.0.5", "vscode-languageserver": "^8.0.2", "vscode-languageserver-textdocument": "^1.0.7" diff --git a/actions-languageservice/package.json b/actions-languageservice/package.json index 2b9ab27..9846a20 100644 --- a/actions-languageservice/package.json +++ b/actions-languageservice/package.json @@ -1,6 +1,6 @@ { "name": "@github/actions-languageservice", - "version": "0.1.45", + "version": "0.1.46", "description": "Language service for GitHub Actions", "license": "MIT", "type": "module", diff --git a/browser-playground/package.json b/browser-playground/package.json index decdce2..2f18da5 100644 --- a/browser-playground/package.json +++ b/browser-playground/package.json @@ -1,12 +1,12 @@ { "name": "browser-playground", - "version": "0.1.45", + "version": "0.1.46", "description": "", "private": true, "main": "index.js", "type": "module", "dependencies": { - "@github/actions-languageserver": "^0.1.45", + "@github/actions-languageserver": "^0.1.46", "monaco-editor-webpack-plugin": "^7.0.1", "monaco-editor-workers": "^0.34.2", "monaco-languageclient": "^4.0.3", diff --git a/lerna.json b/lerna.json index 7ea63b5..8a208b6 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", "useWorkspaces": true, - "version": "0.1.45" + "version": "0.1.46" } diff --git a/package-lock.json b/package-lock.json index e821f90..92e6170 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,10 +16,10 @@ }, "actions-languageserver": { "name": "@github/actions-languageserver", - "version": "0.1.45", + "version": "0.1.46", "license": "MIT", "dependencies": { - "@github/actions-languageservice": "^0.1.45", + "@github/actions-languageservice": "^0.1.46", "@octokit/rest": "^19.0.5", "vscode-languageserver": "^8.0.2", "vscode-languageserver-textdocument": "^1.0.7" @@ -38,7 +38,7 @@ }, "actions-languageservice": { "name": "@github/actions-languageservice", - "version": "0.1.45", + "version": "0.1.46", "license": "MIT", "dependencies": { "@github/actions-workflow-parser": "*", @@ -59,10 +59,10 @@ } }, "browser-playground": { - "version": "0.1.45", + "version": "0.1.46", "license": "MIT", "dependencies": { - "@github/actions-languageserver": "^0.1.45", + "@github/actions-languageserver": "^0.1.46", "monaco-editor-webpack-plugin": "^7.0.1", "monaco-editor-workers": "^0.34.2", "monaco-languageclient": "^4.0.3", @@ -13505,7 +13505,7 @@ "@github/actions-languageserver": { "version": "file:actions-languageserver", "requires": { - "@github/actions-languageservice": "^0.1.45", + "@github/actions-languageservice": "^0.1.46", "@octokit/rest": "^19.0.5", "@types/jest": "^29.0.3", "jest": "^29.0.3", @@ -16288,7 +16288,7 @@ "browser-playground": { "version": "file:browser-playground", "requires": { - "@github/actions-languageserver": "^0.1.45", + "@github/actions-languageserver": "^0.1.46", "css-loader": "^6.7.2", "monaco-editor-webpack-plugin": "^7.0.1", "monaco-editor-workers": "^0.34.2", From 84119f55fb53af72d305fed633be7cec62481846 Mon Sep 17 00:00:00 2001 From: Christopher Schleiden Date: Fri, 9 Dec 2022 13:37:01 -0800 Subject: [PATCH 17/18] Update dependencies from root --- .github/workflows/update-github-dependencies.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/update-github-dependencies.yml b/.github/workflows/update-github-dependencies.yml index 536526e..4f69940 100644 --- a/.github/workflows/update-github-dependencies.yml +++ b/.github/workflows/update-github-dependencies.yml @@ -22,7 +22,6 @@ jobs: - run: | npm update @github/actions-workflow-parser - working-directory: ./actions-languageservice env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 1dd9e095f8b53abf9dd0774eff2845b2ae1dfe88 Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 9 Dec 2022 21:37:48 +0000 Subject: [PATCH 18/18] v0.1.47 --- actions-languageserver/package.json | 4 ++-- actions-languageservice/package.json | 2 +- browser-playground/package.json | 4 ++-- lerna.json | 2 +- package-lock.json | 14 +++++++------- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/actions-languageserver/package.json b/actions-languageserver/package.json index 587a0d9..f84e088 100644 --- a/actions-languageserver/package.json +++ b/actions-languageserver/package.json @@ -1,6 +1,6 @@ { "name": "@github/actions-languageserver", - "version": "0.1.46", + "version": "0.1.47", "description": "Language server for GitHub Actions", "license": "MIT", "type": "module", @@ -38,7 +38,7 @@ "prettier-fix": "prettier --write ." }, "dependencies": { - "@github/actions-languageservice": "^0.1.46", + "@github/actions-languageservice": "^0.1.47", "@octokit/rest": "^19.0.5", "vscode-languageserver": "^8.0.2", "vscode-languageserver-textdocument": "^1.0.7" diff --git a/actions-languageservice/package.json b/actions-languageservice/package.json index 9846a20..8b06804 100644 --- a/actions-languageservice/package.json +++ b/actions-languageservice/package.json @@ -1,6 +1,6 @@ { "name": "@github/actions-languageservice", - "version": "0.1.46", + "version": "0.1.47", "description": "Language service for GitHub Actions", "license": "MIT", "type": "module", diff --git a/browser-playground/package.json b/browser-playground/package.json index 2f18da5..0ced260 100644 --- a/browser-playground/package.json +++ b/browser-playground/package.json @@ -1,12 +1,12 @@ { "name": "browser-playground", - "version": "0.1.46", + "version": "0.1.47", "description": "", "private": true, "main": "index.js", "type": "module", "dependencies": { - "@github/actions-languageserver": "^0.1.46", + "@github/actions-languageserver": "^0.1.47", "monaco-editor-webpack-plugin": "^7.0.1", "monaco-editor-workers": "^0.34.2", "monaco-languageclient": "^4.0.3", diff --git a/lerna.json b/lerna.json index 8a208b6..93d0931 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", "useWorkspaces": true, - "version": "0.1.46" + "version": "0.1.47" } diff --git a/package-lock.json b/package-lock.json index 92e6170..617805e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,10 +16,10 @@ }, "actions-languageserver": { "name": "@github/actions-languageserver", - "version": "0.1.46", + "version": "0.1.47", "license": "MIT", "dependencies": { - "@github/actions-languageservice": "^0.1.46", + "@github/actions-languageservice": "^0.1.47", "@octokit/rest": "^19.0.5", "vscode-languageserver": "^8.0.2", "vscode-languageserver-textdocument": "^1.0.7" @@ -38,7 +38,7 @@ }, "actions-languageservice": { "name": "@github/actions-languageservice", - "version": "0.1.46", + "version": "0.1.47", "license": "MIT", "dependencies": { "@github/actions-workflow-parser": "*", @@ -59,10 +59,10 @@ } }, "browser-playground": { - "version": "0.1.46", + "version": "0.1.47", "license": "MIT", "dependencies": { - "@github/actions-languageserver": "^0.1.46", + "@github/actions-languageserver": "^0.1.47", "monaco-editor-webpack-plugin": "^7.0.1", "monaco-editor-workers": "^0.34.2", "monaco-languageclient": "^4.0.3", @@ -13505,7 +13505,7 @@ "@github/actions-languageserver": { "version": "file:actions-languageserver", "requires": { - "@github/actions-languageservice": "^0.1.46", + "@github/actions-languageservice": "^0.1.47", "@octokit/rest": "^19.0.5", "@types/jest": "^29.0.3", "jest": "^29.0.3", @@ -16288,7 +16288,7 @@ "browser-playground": { "version": "file:browser-playground", "requires": { - "@github/actions-languageserver": "^0.1.46", + "@github/actions-languageserver": "^0.1.47", "css-loader": "^6.7.2", "monaco-editor-webpack-plugin": "^7.0.1", "monaco-editor-workers": "^0.34.2",