From 2d8ff47548356b7e74f9e273e124f315b3f60b9f Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Fri, 24 Oct 2025 15:55:09 +0300 Subject: [PATCH] fix: support INPUT_ACTION_TYPE and INPUT_ACTION (#305) --- npm-publish/README.md | 14 +++++++------- validate-inputs/README.md | 4 ++-- validate-inputs/action.yml | 2 +- validate-inputs/validator.py | 9 ++++++--- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/npm-publish/README.md b/npm-publish/README.md index 352a6f4..6c0f50f 100644 --- a/npm-publish/README.md +++ b/npm-publish/README.md @@ -10,10 +10,10 @@ Publishes the package to the NPM registry with configurable scope and registry U | name | description | required | default | |-------------------|----------------------------------------|----------|----------------------------------------| +| `npm_token` |

NPM token.

| `true` | `""` | | `registry-url` |

Registry URL for publishing.

| `false` | `https://registry.npmjs.org/` | | `scope` |

Package scope to use.

| `false` | `@ivuorinen` | | `package-version` |

The version to publish.

| `false` | `${{ github.event.release.tag_name }}` | -| `npm_token` |

NPM token.

| `true` | `""` | | `token` |

GitHub token for authentication

| `false` | `""` | ### Outputs @@ -33,6 +33,12 @@ This action is a `composite` action. ```yaml - uses: ivuorinen/actions/npm-publish@main with: + npm_token: + # NPM token. + # + # Required: true + # Default: "" + registry-url: # Registry URL for publishing. # @@ -51,12 +57,6 @@ This action is a `composite` action. # Required: false # Default: ${{ github.event.release.tag_name }} - npm_token: - # NPM token. - # - # Required: true - # Default: "" - token: # GitHub token for authentication # diff --git a/validate-inputs/README.md b/validate-inputs/README.md index 969f7d9..8bdbade 100644 --- a/validate-inputs/README.md +++ b/validate-inputs/README.md @@ -10,7 +10,7 @@ Centralized Python-based input validation for GitHub Actions with PCRE regex sup | name | description | required | default | |---------------------|------------------------------------------------------------------------------------|----------|---------| -| `action` |

Action name to validate (alias for action-type)

| `true` | `""` | +| `action` |

Action name to validate (alias for action-type)

| `false` | `""` | | `action-type` |

Type of action to validate (e.g., csharp-publish, docker-build, eslint-fix)

| `false` | `""` | | `rules-file` |

Path to validation rules file

| `false` | `""` | | `fail-on-error` |

Whether to fail on validation errors

| `false` | `true` | @@ -81,7 +81,7 @@ This action is a `composite` action. action: # Action name to validate (alias for action-type) # - # Required: true + # Required: false # Default: "" action-type: diff --git a/validate-inputs/action.yml b/validate-inputs/action.yml index 7889ea9..4d1c055 100644 --- a/validate-inputs/action.yml +++ b/validate-inputs/action.yml @@ -13,7 +13,7 @@ branding: inputs: action: description: 'Action name to validate (alias for action-type)' - required: true + required: false action-type: description: 'Type of action to validate (e.g., csharp-publish, docker-build, eslint-fix)' required: false diff --git a/validate-inputs/validator.py b/validate-inputs/validator.py index f535d75..97bfc8f 100755 --- a/validate-inputs/validator.py +++ b/validate-inputs/validator.py @@ -32,7 +32,7 @@ def collect_inputs() -> dict[str, str]: """ inputs = {} for key, value in os.environ.items(): - if key.startswith("INPUT_") and key != "INPUT_ACTION_TYPE": + if key.startswith("INPUT_") and key not in ("INPUT_ACTION_TYPE", "INPUT_ACTION"): input_name = key[6:].lower() inputs[input_name] = value @@ -73,8 +73,11 @@ def write_output(status: str, action_type: str, **kwargs) -> None: def main() -> None: """Main validation entry point.""" - # Get the action type from environment - action_type = os.environ.get("INPUT_ACTION_TYPE", "").strip() + # Get the action type from environment (check both INPUT_ACTION_TYPE and INPUT_ACTION) + action_type = ( + os.environ.get("INPUT_ACTION_TYPE", "").strip() + or os.environ.get("INPUT_ACTION", "").strip() + ) if not action_type: logger.error("::error::No action type provided") sys.exit(1)