{"id":15650893,"url":"https://github.com/cschleiden/github-actions-parser","last_synced_at":"2025-04-15T21:35:39.928Z","repository":{"id":40418533,"uuid":"266443517","full_name":"cschleiden/github-actions-parser","owner":"cschleiden","description":"🚧 WIP 🚧, beginning of GitHub Actions language server, powering  https://marketplace.visualstudio.com/items?itemName=cschleiden.vscode-github-actions","archived":false,"fork":false,"pushed_at":"2023-01-12T22:16:59.000Z","size":2123,"stargazers_count":34,"open_issues_count":15,"forks_count":13,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T01:34:44.781Z","etag":null,"topics":["actions","github","language-server"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cschleiden.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-24T00:36:10.000Z","updated_at":"2023-11-07T12:54:42.000Z","dependencies_parsed_at":"2023-02-09T13:31:21.959Z","dependency_job_id":null,"html_url":"https://github.com/cschleiden/github-actions-parser","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cschleiden%2Fgithub-actions-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cschleiden%2Fgithub-actions-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cschleiden%2Fgithub-actions-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cschleiden%2Fgithub-actions-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cschleiden","download_url":"https://codeload.github.com/cschleiden/github-actions-parser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246355570,"owners_count":20764018,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","github","language-server"],"created_at":"2024-10-03T12:36:12.571Z","updated_at":"2025-03-30T17:31:53.441Z","avatar_url":"https://github.com/cschleiden.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# github-actions-parser\n\n![CI](https://github.com/cschleiden/github-actions-parser/workflows/CI/badge.svg)\n\nThis package provides a parser and various language-server related features for GitHub Actions.\n\nAuto-completion and validation of expressions (e.g., `${{ secrets.FOO }}`) requires information about the repository that contains the workflow as well as an authenticated [Octokit](https://octokit.github.io/rest.js/v18/) client for making API calls.\n\n## Usage\n\nSome usages examples:\n\n### Parse a workflow\n\n```ts\n// Workflow text\nconst input = \"on: ...\"\n\nconst workflowDoc = await parse({\n  client, // Authenticated Octokit client. Needs at least `repo`, `actions`, and for org-secrets also org admin permissions\n  owner: \"repository-owner\",\n  repository: \"repository\"\n}, input)\n\n// workflowDoc.workflow // Parsed, normalized workflow\n// workflowDoc.diagnostics // Errors/warnings\n// workflowDoc.workflowST // AST\n```\n\n### Auto-complete\n\ntbd\n\n### Get \"hover\" information\n\ntbd\n\n### Evaluate an expression\n\n```ts\nconst result = evaluateExpression(\"${{ env.TEST == 42 }}, {\n  get(contextName: \"github\" | \"env\" | ...) {\n    if (contextName === \"env) {\n      return {\n        TEST: 42\n      };\n    }\n\n    return {};\n  }\n}) // Evaluates to true\n```\n\n## Structure\n\n- `lib/expressions` - Parser and evaluator for GitHub Actions workflow expressions\n- `lib/parser` - Generic YAML parser with validation and auto-complete support\n- `lib/parser/schema` - TypeScript based YAML schema\n- `lib/workflowschema` - GitHub Actions workflow specific parse/complete/hover functions, this is the main exported functionality\n\n## Caching\n\nIn order to auto-complete and validate parts of the workflow depending on the state of other repositories (Actions being used) or some data in the repository the parser needs to make API calls. The results of the API calls are cached for some time to avoid making too many calls. The cache lives in the imported module, which works well for VS Code, for example, where switching repositories means reloading the editor but could lead to issues if the same instance of the module is used for different repositories.\n\n## Acknowledgements\n\nThis library is built on some great open-source projects:\n\n- [octokit/rest](https://octokit.github.io/rest.js/v18/) for making API calls to GitHub\n- [js-yaml](https://github.com/nodeca/js-yaml) for general parsing (e.g., `action.yml` files for `inputs` auto-completion)\n- [yaml-ast-parser](https://github.com/mulesoft-labs/yaml-ast-parser) for parsing the workflow into an AST for validation/auto-completion\n- [chevrotain](https://github.com/SAP/chevrotain) for parsing and running expressions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcschleiden%2Fgithub-actions-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcschleiden%2Fgithub-actions-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcschleiden%2Fgithub-actions-parser/lists"}