TypeScript icon, indicating that this package has built-in type declarations

    0.0.3 • Public • Published

    Actions Inputs

    [GitHub Actions] Auto generate and use input parameters in TypeScript

    Main goal of this module is to auto-generate type-safe code for working with GitHub Actions inputs.

    Use it in Your Action

    1. Install it yarn|npm add actions-inputs
    2. Fill action.yml with input parameters like this:
      # You can also use uppercase here. It doesn't really matter.
        description: |
          The commit message that will be used to commit the changed files. Check the README for all interpolation options.
        # if input isn't provided, Action runner will pick default value even if required is true
        default: "auto-update: replace files from source"
        required: false
        # specify type explicity here if it isn't a string and you don't have default value
        description: |
          [boolean] Run everything except for the copying, removing and commiting functionality.
        required: true
          [number] The number of retries.
        # You can specify string in default, it will be parsed to number anyway.
        default: 3
        required: false
    1. Define postinstall script in package.json:
        "scripts": {
            "postinstall": "actions-inputs generate"
    1. 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.
    2. Use it in your code:
    import { inputs } from "actions-inputs";
    // => boolean
    // => 3 (if user doesn't provide their value)

    Temporary Limitations

    • TypeScript is used to generate library. It's in regular dependencies.
    • You need to manually generate library in postinstall script.

    Things to Note

    • Passing an empty string is the same as not passing anything.


    You can set options before first getInput call.

    List of options: interface Options.

    Possible Types

    By 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?.

    • [string] (default) Any value treats as valid
    • [boolean] Valid: true, false, 0, 1
    • [number] Valid: 54.33, Infinity. Invalid: 5 px


    • [ ] Auto generate type inputs edit in action.yml (show warning on main)
    • [ ] Use main-dev Action deploy system (remove required)
    • [ ] Describe Files Structure and does it work. Why some ts files in src why some in src etc.
    • [ ] Testsss
    • [ ] Add --watch options
    • [ ] StringArray type


    npm i actions-inputs

    DownloadsWeekly Downloads






    Unpacked Size

    13 kB

    Total Files


    Last publish


    • zardoy