{"id":16149055,"url":"https://github.com/zardoy/actions-inputs","last_synced_at":"2025-04-06T21:36:44.669Z","repository":{"id":46674206,"uuid":"338550538","full_name":"zardoy/actions-inputs","owner":"zardoy","description":"[GitHub Actions] Auto generate input parameters for TypeScript","archived":false,"fork":false,"pushed_at":"2021-10-04T06:48:44.000Z","size":110,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-13T03:41:20.609Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/zardoy.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2021-02-13T10:36:40.000Z","updated_at":"2021-10-03T01:10:15.000Z","dependencies_parsed_at":"2022-09-13T07:21:51.797Z","dependency_job_id":null,"html_url":"https://github.com/zardoy/actions-inputs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zardoy%2Factions-inputs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zardoy%2Factions-inputs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zardoy%2Factions-inputs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zardoy%2Factions-inputs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zardoy","download_url":"https://codeload.github.com/zardoy/actions-inputs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247557793,"owners_count":20958045,"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":[],"created_at":"2024-10-10T00:36:20.892Z","updated_at":"2025-04-06T21:36:44.632Z","avatar_url":"https://github.com/zardoy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Actions Inputs\n\n\u003e [GitHub Actions] Auto generate and use input parameters in TypeScript\n\nMain goal of this module is to auto-generate **type-safe** code for working with [GitHub Actions inputs](https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs).\n\n- [Actions Inputs](#actions-inputs)\n  - [Use it in Your Action](#use-it-in-your-action)\n  - [Temporary Limitations](#temporary-limitations)\n  - [Things to Note](#things-to-note)\n  - [Options](#options)\n  - [Possible Types](#possible-types)\n  - [TODO](#todo)\n\n## Use it in Your Action\n\n1. Install it `yarn|npm add actions-inputs`\n2. Fill `action.yml` with input parameters like this:\n\n```yml\ninputs:\n  # You can also use uppercase here. It doesn't really matter.\n  COMMIT_MESSAGE:\n    description: |\n      The commit message that will be used to commit the changed files. Check the README for all interpolation options.\n    # if input isn't provided, Action runner will pick default value even if required is true\n    default: \"auto-update: replace files from source\"\n    required: false\n  DRY_RUN:\n    # specify type explicity here if it isn't a string and you don't have default value\n    description: |\n      [boolean] Run everything except for the copying, removing and commiting functionality.\n    required: true\n  RETRIES:\n    # You don't need to specify type in description if it can be inferred from default property\n    description:\n      The number of retries.\n    # But if you specify string here, resulting type will be string too so be careful.\n    default: 3\n    required: false\n```\n\n3. Define `postinstall` script in `package.json`:\n\n```json5\n{\n    \"scripts\": {\n        //...\n        \"postinstall\": \"actions-inputs generate\"\n    }\n}\n```\n\n4. Run `postinstall` script or `yarn actions-inputs generate` command in order to generate library so that you can safely use it in your code. You need to run this command every time after you edit `action.yml`.\n5. Use it in your code:\n\n```ts\nimport { inputs } from \"actions-inputs\";\n\ninputs.dry_run\n// =\u003e boolean\n\ninputs.retries\n// =\u003e 3 (if user doesn't provide their value)\n\n```\n\n## Temporary Limitations\n\n- TypeScript is used to generate library. It's in regular dependencies.\n- You need to manually generate library in `postinstall` script.\n\n## Things to Note\n\n- Passing an empty string is the same as not passing anything.\n\n## Options\n\nYou can set options before first `getInput` call.\n\nList of options: [interface Options](build/entrypointTemplate.ts).\n\n## Possible Types\n\nBy default the type infers from input's `default` property, but if it's required and not a string, you need to specify type in start of `description` like this: `description: [boolean] should I show you a red light?`.\n\n- [string] (default) Any value treats as valid\n- [boolean] Valid: `true`, `false`, `0`, `1`\n- [number] Valid: `54.33`, `Infinity`. Invalid: `5 px`\n\n## TODO\n\n- [ ] Auto generate type `inputs` edit in `action.yml` (show warning on `main`)\n- [ ] Use **main-dev** Action deploy system (remove required)\n- [ ] Describe Files Structure and does it work. Why some ts files in src why some in src etc.\n- [ ] Testsss\n- [ ] Add --watch options\n- [ ] StringArray type\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzardoy%2Factions-inputs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzardoy%2Factions-inputs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzardoy%2Factions-inputs/lists"}