Skip to content

Conversation

@rmottanet
Copy link
Contributor

This pull request refactors the branch-create GitHub Action to improve input handling, type safety, and error robustness. It also updates the compiled artifact to ensure the distributed dist/index.js aligns with the latest source changes.


Key Improvements

1. Enhanced Input Handling

  • All incoming inputs (github_token, owner, repo, branch, new_name) now include .trim() normalization to prevent whitespace-related issues.
  • Required input declarations remain enforced for reliability.

2. Improved Type Safety

  • Explicit TypeScript annotations applied to all input variables.
  • run() function now returns Promise<void> with JSDoc documentation for clarity and maintainability.

3. Robust Error Handling

  • Introduced unknown catch block with an instanceof Error guard.
  • Ensures correct handling of unexpected failures while providing clearer failure messaging.

4. Safer Async Execution

  • Replaced run() invocation with void run() to explicitly signal the intentionally unhandled promise.

5. Updated Compiled Artifact

  • Regenerated dist/index.js to reflect all refactoring work and maintain consistency with the Action's distributed version.

Motivation

These changes improve code clarity, maintainability, and runtime safety. They also align the Action with best practices for TypeScript-based GitHub Actions, reducing the likelihood of silent failures or malformed input scenarios.


Impact

No breaking changes.
The Action’s external behavior remains consistent, with improvements applied internally to resilience, maintainability, and reliability.

* refactor: improve input handling, typing, and error safety in branch create action

- Add explicit TypeScript types for all inputs
- Trim all received inputs to avoid whitespace-related failures
- Strengthen error handling with unknown type guard
- Add JSDoc annotation for main function
- Replace direct run() call with void run() for explicit async invocation
- Maintain existing GitHub API request logic while improving reliability

* build: update compiled artifact in dist/index.js

- Regenerate dist output to reflect recent refactor and typing improvements
- Align compiled bundle with updated input validation and enhanced error handling
@rmottanet rmottanet self-assigned this Nov 24, 2025
@rmottanet rmottanet added the enhancement New feature or request label Nov 24, 2025
@rmottanet rmottanet merged commit 6b57ccf into ws2git:main Nov 24, 2025
@rmottanet rmottanet deleted the enhance branch November 24, 2025 20:52
@github-project-automation github-project-automation bot moved this from Todo to Done in Typed Actions Stack Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Development

Successfully merging this pull request may close these issues.

1 participant