### Install actions-languageserver via Homebrew Source: https://github.com/actions/languageservices/blob/main/languageserver/README.md Installs the language server using Homebrew, making the 'actions-languageserver' command available globally. ```bash brew install actions-languageserver ``` -------------------------------- ### Install @actions/languageserver via npm Source: https://github.com/actions/languageservices/blob/main/languageserver/README.md Installs the package as a dependency for your project. ```bash npm install @actions/languageserver ``` -------------------------------- ### Install dependencies locally Source: https://github.com/actions/languageservices/blob/main/browser-playground/README.md Run this command to install dependencies locally for the package, required before running webpack-dev-server. ```bash npm i --workspaces=false ``` -------------------------------- ### Install dependencies with npm i Source: https://github.com/actions/languageservices/blob/main/CONTRIBUTING.md Run from the repository root to install all dependencies using npm workspaces. Requires Node.js >= 18 and npm >= 7. ```bash $ npm i ``` -------------------------------- ### Install @actions/languageserver globally via npm Source: https://github.com/actions/languageservices/blob/main/languageserver/README.md Installs the language server as a standalone CLI, making the 'actions-languageserver' command available globally. ```bash npm install -g @actions/languageserver ``` -------------------------------- ### Run actions-languageserver with stdio Source: https://github.com/actions/languageservices/blob/main/languageserver/README.md Starts the language server using stdio transport, which is the standard way for editors to communicate with language servers. ```bash actions-languageserver --stdio ``` -------------------------------- ### Link and run actions-languageserver locally Source: https://github.com/actions/languageservices/blob/main/languageserver/README.md After building the CLI, link the package globally with npm link, then start the server with actions-languageserver --stdio. Use npm run watch:cli to rebuild automatically. ```bash npm run build:cli npm link ``` ```bash actions-languageserver --stdio ``` ```bash npm run watch:cli ``` -------------------------------- ### Install @actions/languageservice Source: https://github.com/actions/languageservices/blob/main/languageservice/README.md Installs the @actions/languageservice package, which contains TypeScript types and compiled ECMAScript modules. ```bash npm install @actions/languageservice ``` -------------------------------- ### Install @actions/workflow-parser with npm Source: https://github.com/actions/languageservices/blob/main/workflow-parser/README.md Install the package from npm. The package includes TypeScript types and compiled ECMAScript modules. ```bash npm install @actions/workflow-parser ``` -------------------------------- ### Install @actions/expressions Source: https://github.com/actions/languageservices/blob/main/expressions/README.md Install the @actions/expressions package from npm. The package includes TypeScript types and compiled ECMAScript modules. ```bash npm install @actions/expressions ``` -------------------------------- ### Auto-completion with complete() and example response Source: https://github.com/actions/languageservices/blob/main/languageservice/README.md Triggers auto-completion for a workflow file at a given position. The example shows a completion request for `on: |` and the returned suggestions array, which includes an event label and text edit range. ```typescript import {complete} from "@actions/languageservice"; const document = { uri: "file:///path/to/file", getText: () => `on: jobs: build: runs-on: ubuntu-latest steps: - run: echo hello` }; // Trigger completion for `on: |` const suggestions = await complete(document, {line: 0, character: 4}); ``` ```jsonc [{ "documentation": { "kind": "markdown", "value": "Runs your workflow when branch protection rules in the workflow repository are changed.", }, "label": "branch_protection_rule", "textEdit": { "newText": "branch_protection_rule", "range": { "end": {"character": 4, "line": 0,}, "start": {"character": 4, "line": 0}, }, }, }, //... other events ] ``` -------------------------------- ### User import of @actions/expressions Source: https://github.com/actions/languageservices/blob/main/docs/esm-migration-plan.md Example of a user importing from the @actions/expressions package, which fails at runtime because the published ESM code lacks file extensions. ```javascript // User's code import { Expr } from "@actions/expressions"; ``` -------------------------------- ### hover(document, position) Source: https://github.com/actions/languageservices/blob/main/languageservice/README.md Gets hover information for a token in the workflow file. ```APIDOC ## hover(document, position) ### Description Gets information when hovering over a token in the workflow file. ### Method Function call ### Parameters - **document** (object) - Required - The document object with `uri` and `getText` method. - **position** (Position) - Required - The position in the document (line and character). ### Request Example ```typescript import {hover} from "@actions/languageservice"; const document = { uri: "file:///path/to/file", getText: () => "on: push\n jobs:\n build:\n runs-on: ubuntu-latest\n steps:\n - run: echo hello" }; const hover = await hover(document, {line: 0, character: 1}); ``` ### Response Returns an object with `contents` containing markdown information. ``` -------------------------------- ### Stripped fields example: before and after Source: https://github.com/actions/languageservices/blob/main/docs/json-data-files.md Shows which fields are kept after stripping unused fields from webhooks.all.json to produce webhooks.json. Only name, description, and childParamsGroups are kept for autocompletion and hover docs. ```json // Before (from webhooks.all.json) { "type": "object", "name": "issue", "in": "body", "description": "The issue itself.", "isRequired": true, "childParamsGroups": [...] } // After (webhooks.json) { "name": "issue", "description": "The issue itself.", "childParamsGroups": [...] } ``` -------------------------------- ### Get hover information with hover() Source: https://github.com/actions/languageservices/blob/main/languageservice/README.md Gets hover information for a token in a workflow file. The document object must provide a uri and getText method. The result contains markdown content describing the hovered token. ```typescript import {hover} from "@actions/languageservice"; const document = { uri: "file:///path/to/file", getText: () => "on: push\n jobs:\n build:\n runs-on: ubuntu-latest\n steps:\n - run: echo hello" }; const hover = await hover(document, {line: 0, character: 1}); // { contents: { kind: "markdown", value: "The event that triggers the workflow" } } ``` -------------------------------- ### New webhook event error output Source: https://github.com/actions/languageservices/blob/main/docs/json-data-files.md Example error output from the update-webhooks script when GitHub adds a new webhook event that is not categorized. The script fails and lists the uncategorized event names, requiring manual action to add them to DROPPED_EVENTS or KEPT_EVENTS. ```text ERROR: New webhook event(s) detected! The following events are not categorized: - new_event_name Action required: 1. Check if the event is a valid workflow trigger 2. Add the event to DROPPED_EVENTS or KEPT_EVENTS ``` -------------------------------- ### Schema Sync Test Failure Error Message Source: https://github.com/actions/languageservices/blob/main/docs/json-data-files.md Example error message shown when the schema-sync test fails, indicating a missing activity type for an event in workflow-v1.0.json. ```text Event "pull_request" is missing activity type "new_activity" in workflow-v1.0.json ``` -------------------------------- ### Build and serve the app Source: https://github.com/actions/languageservices/blob/main/browser-playground/README.md Run this command to build and serve the app at localhost:8080. ```bash npm start ``` -------------------------------- ### Build all packages with `npx lerna run build` Source: https://github.com/actions/languageservices/blob/main/AGENTS.md Use in the project root to build all packages with Lerna. ```bash npx lerna run build ``` -------------------------------- ### Build the project with npm run build Source: https://github.com/actions/languageservices/blob/main/workflow-parser/README.md Builds the project. Use npm run watch to rebuild on changes. ```bash npm run build ``` -------------------------------- ### Build the language server Source: https://github.com/actions/languageservices/blob/main/languageserver/README.md Run npm run build to compile the project. Use npm run watch to rebuild automatically on changes. ```bash npm run build ``` ```bash npm run watch ``` -------------------------------- ### Watch for changes with npm run watch Source: https://github.com/actions/languageservices/blob/main/workflow-parser/README.md Builds the project and watches for changes. ```bash npm run watch ``` -------------------------------- ### InitializationOptions interface Source: https://github.com/actions/languageservices/blob/main/languageserver/README.md Defines the initialization options accepted by the language server. The sessionToken requires the 'repo' and 'workflow' scopes and enables additional validations and auto-completion suggestions. ```typescript export interface InitializationOptions { /** * GitHub token that will be used to retrieve additional information from github.com * * Requires the `repo` and `workflow` scopes */ sessionToken?: string; /** * List of repositories that the language server should be aware of */ repos?: RepositoryContext[]; /** * Desired log level */ logLevel?: LogLevel; /** * Experimental features that are opt-in */ experimentalFeatures?: ExperimentalFeatures; } ``` -------------------------------- ### Enable experimental features via initializationOptions Source: https://github.com/actions/languageservices/blob/main/languageserver/README.md Shows how to enable experimental features using the 'experimentalFeatures' option. Individual feature flags take precedence over 'all'. ```typescript initializationOptions: { experimentalFeatures: { // Enable all experimental features all: true, // Or enable specific features missingInputsQuickfix: true, } } ``` -------------------------------- ### Format changed files and verify with `npm run format-check -ws` Source: https://github.com/actions/languageservices/blob/main/AGENTS.md Always run formatting before committing. First format changed files with Prettier, then verify with the format-check script across all workspaces. ```bash npx prettier --write ``` ```bash npm run format-check -ws ``` -------------------------------- ### Pass initializationOptions to LanguageClient Source: https://github.com/actions/languageservices/blob/main/languageserver/README.md Shows how to pass the initializationOptions to the LanguageClient when establishing the connection. ```typescript const clientOptions: LanguageClientOptions = { documentSelector: [{ pattern: "**/.github/workflows/*.{yaml,yml}" }], initializationOptions: initializationOptions }; const client = new LanguageClient("actions-language", "GitHub Actions Language Server", serverOptions, clientOptions); ``` -------------------------------- ### Create LSP configuration for actionsls Source: https://github.com/actions/languageservices/blob/main/languageserver/README.md LSP configuration for Neovim 0.11+ to be placed in ~/.config/nvim/lsp/actionsls.lua. It sets the command to 'actions-languageserver --stdio', restricts attachment to workflow directories, optionally provides a GitHub token and repo context, and handles the 'actions/readFile' request. ```lua local function get_github_token() local handle = io.popen("gh auth token 2>/dev/null") if not handle then return nil end local token = handle: read("*a"):gsub("%s+", "") handle:close() return token ~= "" and token or nil end local function parse_github_remote(url) if not url or url == "" then return nil end -- SSH format: git@github.com:owner/repo.git local owner, repo = url:match("git@github%.com:([^/]+)/([^/%.]+)") if owner and repo then return owner, repo: gsub("%.git$", "") end -- HTTPS format: https://github.com/owner/repo.git owner, repo = url:match("github%.com/([^/]+)/([^/%.]+)") if owner and repo then return owner, repo:gsub("%.git$", "") end return nil end local function get_repo_info(owner, repo) local cmd = string.format( "gh repo view %s/%s --json id,owner --template '{{.id}}\t{{.owner.type}}' 2>/dev/null", owner, repo ) local handle = io.popen(cmd) if not handle then return nil end local result = handle: read("*a"):gsub("%s+$", "") handle:close() local id, owner_type = result:match("^(%d+)\t(.+)$") if id then return { id = tonumber(id), organizationOwned = owner_type == "Organization", } end return nil end local function get_repos_config() local handle = io.popen("git rev-parse --show-toplevel 2>/dev/null") if not handle then return nil end local git_root = handle: read("*a"):gsub("%s+", "") handle:close() if git_root == "" then return nil end handle = io.popen("git remote get-url origin 2>/dev/null") if not handle then return nil end local remote_url = handle:read("*a"):gsub("%s+", "") handle:close() local owner, name = parse_github_remote(remote_url) if not owner or not name then return nil end local info = get_repo_info(owner, name) return { { id = info and info.id or 0, owner = owner, name = name, organizationOwned = info and info.organizationOwned or false, workspaceUri = "file://" .. git_root, }, } end return { cmd = { "actions-languageserver", "--stdio" }, filetypes = { "yaml.ghactions" }, -- `root_dir` ensures that the LSP does not attach to all yaml files root_dir = function(bufnr, on_dir) local parent = vim.fs.dirname(vim.api.nvim_buf_get_name(bufnr)) if vim.endswith(parent, '/.github/workflows') or vim.endswith(parent, '/.forgejo/workflows') or vim.endswith(parent, '/.gitea/workflows') then on_dir(parent) end end, init_options = { -- Optional: provide a GitHub token and repo context for added functionality -- (e.g., repository-specific completions) sessionToken = get_github_token(), repos = get_repos_config(), }, -- allow the lsp to register capabilities on demand capabilities = { workspace = { didChangeWorkspaceFolders = { dynamicRegistration = true, }, }, }, -- given a file:// protocol path as built using the workspaceUri above, -- resolve path to disk path and provide filecontents when lsp requests this -- action https://github.com/actions/languageservices/blob/main/languageserver/src/request.ts#L2 -- taken from https://github.com/neovim/nvim-lspconfig/blob/75e49cfa588a89ca667d767c0afef3ceac205faa/lsp/gh_actions_ls.lua#L33-L48 handlers = { ["actions/readFile"] = function(_, result) if type(result.path) ~= "string" then return nil, nil end local file_path = vim.uri_to_fname(result.path) if vim.fn.filereadable(file_path) == 1 then local f = assert(io.open(file_path, "r")) local text = f:read("*a") f:close() return text, nil end return nil, nil end, }, } ``` -------------------------------- ### Enable actionsls LSP Source: https://github.com/actions/languageservices/blob/main/languageserver/README.md Enables the actionsls LSP in Neovim's init.lua. ```lua vim.lsp.enable('actionsls') ``` -------------------------------- ### Run format check with npm run format-check Source: https://github.com/actions/languageservices/blob/main/workflow-parser/README.md Runs the format check (lint) using prettier. ```bash npm run format-check ``` -------------------------------- ### Run minify-json script Source: https://github.com/actions/languageservices/blob/main/docs/json-data-files.md Command to minify all JSON files, producing .min.json versions. Runs automatically via prebuild and pretest hooks. ```bash npm run minify-json ``` -------------------------------- ### Run package tests with npm workspaces Source: https://github.com/actions/languageservices/blob/main/AGENTS.md Run tests for the specified packages individually with npm workspaces. Use instead of testing the whole monorepo at once. ```bash npm -w @actions/expressions test npm -w @actions/workflow-parser test npm -w @actions/languageservice test ``` -------------------------------- ### Run tests with npm test Source: https://github.com/actions/languageservices/blob/main/workflow-parser/README.md Runs the test suite. Use npm run test-watch to watch for changes and run tests. ```bash npm test ``` -------------------------------- ### Set up filetype detection for GitHub Actions workflows Source: https://github.com/actions/languageservices/blob/main/languageserver/README.md Adds filetype detection for GitHub Actions workflow files in Neovim's init.lua. Sets the filetype to 'yaml.ghactions' for YAML files in .github/workflows/, allowing separate YAML LSP configurations. ```lua vim.filetype.add({ pattern = { [".*/%.github/workflows/.*%.ya?ml"] = "yaml.ghactions", }, }) ``` -------------------------------- ### Watch for changes and run tests with npm run test-watch Source: https://github.com/actions/languageservices/blob/main/workflow-parser/README.md Runs tests in watch mode, watching for changes and running tests automatically. ```bash npm run test-watch ``` -------------------------------- ### Generate full unprocessed webhook data Source: https://github.com/actions/languageservices/blob/main/docs/json-data-files.md Run with the --all flag to generate webhooks.all.json and objects.all.json containing the complete unprocessed data from the GitHub API. These files are gitignored and useful for viewing all available fields and events before optimization. ```bash npm run update-webhooks -- --all ``` -------------------------------- ### Create LanguageClient in client.ts Source: https://github.com/actions/languageservices/blob/main/languageserver/README.md For the client, create a new LanguageClient pointing to the server module. The clientOptions specify the document selector for GitHub Actions workflow files. ```typescript import {LanguageClient, ServerOptions, TransportKind} from "vscode-languageclient/node"; const debugOptions = {execArgv: ["--nolazy", "--inspect=6010"]}; const clientOptions: LanguageClientOptions = { documentSelector: [{ pattern: "**/.github/workflows/*.{yaml,yml}" }] }; const serverModule = context.asAbsolutePath(path.join("dist", "server.js")); const serverOptions: ServerOptions = { run: {module: serverModule, transport: TransportKind.ipc}, debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions } }; const client = new LanguageClient("actions-language", "GitHub Actions Language Server", serverOptions, clientOptions); ``` -------------------------------- ### complete(document, position) Source: https://github.com/actions/languageservices/blob/main/languageservice/README.md Provides auto-completion suggestions for the workflow file. ```APIDOC ## complete(document, position) ### Description Provides auto-completion suggestions for the workflow file at a given position. ### Method Function call ### Parameters - **document** (object) - Required - The document object with `uri` and `getText` method. - **position** (Position) - Required - The position in the document (line and character). ### Request Example ```typescript import {complete} from "@actions/languageservice"; const document = { uri: "file:///path/to/file", getText: () => `on: jobs: build: runs-on: ubuntu-latest steps: - run: echo hello` }; const suggestions = await complete(document, {line: 0, character: 4}); ``` ### Response Returns an array of completion items with `label`, `documentation`, and `textEdit`. ``` -------------------------------- ### Verify actionsls LSP with :checkhealth vim.lsp Source: https://github.com/actions/languageservices/blob/main/languageserver/README.md Runs Neovim's health check to verify the LSP is attached. You should see 'actionsls' in the list of attached clients. ```vim :checkhealth vim.lsp ``` -------------------------------- ### tsconfig.build.json for each migrated package Source: https://github.com/actions/languageservices/blob/main/docs/esm-migration-plan.md Configuration for TypeScript build with node16 module resolution. Uses Option B (manual .js extensions) because Option A caused ts-jest tests to hang. Includes skipLibCheck to work around @types/node compatibility issues with TypeScript 5.x (TS2386). ```json { "compilerOptions": { "module": "node16", "moduleResolution": "node16", "skipLibCheck": true, "lib": ["ES2022"], "target": "ES2022" } } ``` -------------------------------- ### jest.config.js for each migrated package Source: https://github.com/actions/languageservices/blob/main/docs/esm-migration-plan.md Jest configuration using ts-jest preset for ESM. Maps .js and .ts extensions to their source files, and transforms TypeScript with ESM support and isolated modules. ```javascript /** @type {import('ts-jest').JestConfigWithTsJest} */ export default { preset: "ts-jest/presets/default-esm", moduleNameMapper: { "^(\\.{1,2}/.*)\\.js$": "$1", "^(\\.{1,2}/.*)\\.ts$": "$1", }, transform: { "^.+\\.tsx?$": [ "ts-jest", { useESM: true, isolatedModules: true, }, ], }, moduleFileExtensions: ["ts", "js"], }; ``` -------------------------------- ### Import @actions/languageserver in server.ts Source: https://github.com/actions/languageservices/blob/main/languageserver/README.md For the server, import the module. It detects whether it's running in a Node.js environment or a web worker and initializes the appropriate connection. ```typescript import "@actions/languageserver"; ``` -------------------------------- ### Simple expression evaluation with @actions/expressions Source: https://github.com/actions/languageservices/blob/main/expressions/README.md Parse and evaluate a simple expression '1 == 2' with no context data. The result is false, as shown by the console output. ```ts import { Parser, Lexer, Evaluator, data } from '@actions/expressions'; const lexer = new Lexer("1 == 2"); const lr = lexer.lex(); const parser = new Parser(lr.tokens, [], []); const expr = parser.parse(); const evaluator = new Evaluator(expr, new data.Dictionary()); const result = evaluator.evaluate(); console.log(result.coerceString()) // false ``` -------------------------------- ### TypeScript 5.7+ rewriteRelativeImportExtensions config Source: https://github.com/actions/languageservices/blob/main/docs/esm-migration-plan.md Recommended TypeScript 5.7+ compiler configuration that automatically rewrites .ts extensions to .js in output. ```jsonc { "compilerOptions": { "moduleResolution": "node16", // or "nodenext" "rewriteRelativeImportExtensions": true } } ``` -------------------------------- ### Regenerate webhooks and objects JSON Source: https://github.com/actions/languageservices/blob/main/docs/json-data-files.md Run from the languageservice directory to regenerate webhooks.json and objects.json from the GitHub REST API description. The script validates event categorization, drops non-workflow-trigger events, strips unused fields, deduplicates shared objects, and writes pretty-printed JSON files. ```bash cd languageservice npm run update-webhooks ``` -------------------------------- ### Manual .js extension import Source: https://github.com/actions/languageservices/blob/main/docs/esm-migration-plan.md Manual .js extension approach: source TypeScript files use .js extensions in import paths, which works with TypeScript 4.7+ and node16 moduleResolution. ```typescript import { Expr } from "./ast.js"; // Points to .ts file, but use .js extension ``` -------------------------------- ### Validate a workflow file with validate() Source: https://github.com/actions/languageservices/blob/main/languageservice/README.md Validates a workflow file using the language service. Requires a ValidationConfig with value and context provider configurations, and returns an array of Diagnostic objects. ```typescript const config: ValidationConfig = { valueProviderConfig: valueProviders(sessionToken, repoContext, cache), contextProviderConfig: contextProviders(sessionToken, repoContext, cache), }; const result = await validate(textDocument, config); // result is an array of `Diagnostic` ``` -------------------------------- ### ERR_MODULE_NOT_FOUND error Source: https://github.com/actions/languageservices/blob/main/docs/esm-migration-plan.md The Node.js error message that occurs when importing the package due to missing file extensions in the published ESM code. ```text Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../node_modules/@actions/expressions/dist/ast' ``` -------------------------------- ### Each workspace package.json devDependencies Source: https://github.com/actions/languageservices/blob/main/docs/esm-migration-plan.md DevDependencies for each workspace package, specifying TypeScript and ts-jest versions. ```json { "devDependencies": { "typescript": "^5.8.3", "ts-jest": "^29.0.3" } } ``` -------------------------------- ### Import minified webhooks JSON Source: https://github.com/actions/languageservices/blob/main/docs/json-data-files.md Imports the minified webhooks JSON file in TypeScript code. ```typescript import webhooks from "./events/webhooks.min.json" ``` -------------------------------- ### Expression evaluation with context data Source: https://github.com/actions/languageservices/blob/main/expressions/README.md Evaluate an expression that references context data. The expression compares 'monalisa' to context.name, and the context dictionary provides the value. The result is true. ```ts import { Parser, Lexer, Evaluator, data } from '@actions/expressions'; const lexer = new Lexer("'monalisa' == context.name"); const lr = lexer.lex(); const parser = new Parser(lr.tokens, ["context"], []); const expr = parser.parse(); const evaluator = new Evaluator(expr, new data.Dictionary([{ key: "context" value: new data.Dictionary([{ key: "name" value: new data.StringData("monalisa") }]) }])); const result = evaluator.evaluate(); console.log(result.coerceString()) // true ``` -------------------------------- ### validate(textDocument, config) Source: https://github.com/actions/languageservices/blob/main/languageservice/README.md Validates a workflow file and returns an array of Diagnostic objects. ```APIDOC ## validate(textDocument, config) ### Description Validates a workflow file and returns an array of `Diagnostic` objects. ### Method Function call ### Parameters - **textDocument** (TextDocument) - Required - The workflow file document to validate. - **config** (ValidationConfig) - Required - Configuration containing `valueProviderConfig` and `contextProviderConfig`. ### Request Example ```typescript const config: ValidationConfig = { valueProviderConfig: valueProviders(sessionToken, repoContext, cache), contextProviderConfig: contextProviders(sessionToken, repoContext, cache), }; const result = await validate(textDocument, config); ``` ### Response Returns an array of `Diagnostic` objects. ``` -------------------------------- ### Add npm overrides for TypeScript 5.8.3 in root package.json Source: https://github.com/actions/languageservices/blob/main/docs/esm-migration-plan.md Add npm overrides to the root package.json to force TypeScript 5.8.3 throughout the monorepo, preventing version conflicts where a root typescript 4.9.5 (from ts-node and tsutils) contradicts workspace packages specifying ^5.8.3. ```json { "overrides": { "typescript": "5.8.3" } } ``` -------------------------------- ### Source import with .ts extension Source: https://github.com/actions/languageservices/blob/main/docs/esm-migration-plan.md Source code using .ts extensions, which TypeScript 5.7+ with rewriteRelativeImportExtensions will transform to .js in the compiled output. ```typescript import { Expr } from "./ast.ts"; ``` -------------------------------- ### Compiled output with .js extension Source: https://github.com/actions/languageservices/blob/main/docs/esm-migration-plan.md Compiled output after TypeScript rewrites the .ts extension to .js, making the ESM code valid for Node.js. ```javascript export { Expr } from "./ast.js"; ``` -------------------------------- ### Invalid ESM output without .js extension Source: https://github.com/actions/languageservices/blob/main/docs/esm-migration-plan.md Shows the invalid ESM output that TypeScript emits when using "moduleResolution": "node", which omits the required .js file extension in import paths. ```javascript // Published to npm - INVALID ESM export { Expr } from "./ast"; // Missing .js extension! ``` -------------------------------- ### Parse workflow YAML with parseWorkflow Source: https://github.com/actions/languageservices/blob/main/workflow-parser/README.md Parses a workflow YAML string into an intermediate representation and validates it against the schema. Parsing errors are returned in the errors property of the result context. ```typescript var trace: TraceWriter; const result = parseWorkflow( { name: "test.yaml", content: `on: push jobs: build: runs-on: ubuntu-latest steps: - run: echo 'hello'` }, trace ); ``` -------------------------------- ### vscode-languageserver package.json missing exports field Source: https://github.com/actions/languageservices/blob/main/docs/esm-migration-plan.md vscode-languageserver package.json excerpt (v8.0.2) showing only main and browser fields without an exports field, which breaks subpath imports under `moduleResolution: "node16"`. This causes TS2307 errors for 'vscode-languageserver/browser' and 'vscode-languageserver/node'. ```json { "main": "./lib/node/main.js", "browser": { "./lib/node/main.js": "./lib/browser/main.js" } // No "exports" field! } ``` -------------------------------- ### Convert intermediate representation to WorkflowTemplate Source: https://github.com/actions/languageservices/blob/main/workflow-parser/README.md Converts the intermediate representation from parseWorkflow into a WorkflowTemplate object, which is more convenient for working with workflows. The comments show expected property values. ```typescript const workflowTemplate = await convertWorkflowTemplate(result.context, result.value); // workflowTemplate.jobs[0].id === "build" // workflowTemplate.jobs[0].steps[0].run === "echo 'hello'" ``` -------------------------------- ### ts-jest TypeError with TypeScript 5.9+ (ParseAll) Source: https://github.com/actions/languageservices/blob/main/docs/esm-migration-plan.md The error from ts-jest 29.4.6 when using TypeScript 5.9+, because it references `typescript.JSDocParsingMode.ParseAll` which is not available in TypeScript's ESM exports. Workarounds include using ts-jest 29.0.3, waiting for a fix, or staying on TypeScript 5.8.3. ```plaintext TypeError: Cannot read properties of undefined (reading 'ParseAll') at Object. (node_modules/ts-jest/dist/compiler/ts-compiler.js:43:123) ```