July 2, 2023 • ☕️ 2 min read
日本語

Problem of typescript-action

When creating a GitHub Action, we often use the official typescript-action. While it is indeed user-friendly, there are several challenges when it comes to maintenance:

  1. It lacks a mechanism to keep the library up to date.
  2. It lacks an automatic changelogs generation feature.
  3. It lacks an automated version incrementation mechanism, and every release requires manually updating the major version tag.

To address the above challenges, I have created an enhanced version of typescript-action called advanced-typescript-action template.

New features in advanced-typescript-action

  1. Use Vitest instead of jest

    Vitest is significantly faster than jest and even faster than @swc/jest.

  2. Use renovate to keep the library up to date.

    Use renovate to ensure the library remains up to date with the latest versions.

  3. Use changesets for automatic change log generation and version management. Changesets are automatically added to renovate pull requests.

    When changesets pull requests are merged, tags are automatically applied. Major version tags are also updated automatically.

Example of normal PR

Let me explain the process of submitting a fix pull request (PR) using the current version v1.0.2 of the GitHub Action as an example.

  1. Make the patch fix and submit a pull request (PR).
  2. Add changesets to the PR (either by adding them locally using pnpm changeset or by clicking the link in the comment from the changeset bot within the PR - both methods are acceptable).
  3. Merge the PR.

And then, the version of the GitHub Action will be automatically updated to v1.0.3, and the tag v1.0.3 will be added. The v1 tag will also be updated from the commit of v1.0.2 to the commit of v1.0.3.

Example of renovate PR

Let me explain the process of submitting a fix pull request (PR) using the current version v1.0.2 of the GitHub Action as an example.

  1. Renovate generates a pull request (PR) during the specified time frame.
  2. Patch fix changesets are automatically added to the PR.
  3. If the tests pass, the PR is automatically merged.

And similarly to the “Example of a normal PR”, the version of the GitHub Action will be automatically updated to v1.0.3, and the v1.0.3 tag will be added. The v1 tag will also be updated from the commit of v1.0.2 to the commit of v1.0.3.

If you add enough tests, the library’s version up can totally be automated.

That’s it

Hope this template helps you.

https://github.com/thundermiracle/advanced-typescript-action


ThunderMiracle

Blog part of ThunderMiracle.com