ashvardanian / tinysemver

Tiny Semantic Versioning (SemVer) library and GitHub CI, that doesn't depend on 300K lines of JavaScript code and fits in a single Python file
https://github.com/marketplace/actions/tinysemver
Apache License 2.0
13 stars 2 forks source link

feat: implement GitHub Action #2

Closed grouville closed 1 month ago

grouville commented 1 month ago

Fixes #1

Implements the GitHub Action. Testing on the side, on my fork: https://github.com/grouville/tinysemver

The idea is, to avoid the recursive call, there are two choices:

  1. run the action nonetheless and handle the skip inside its logic
  2. Have a more declarative model in which users can filter out, and use your pipeline as a reference

I tend more with the second one, as users can avoid wasting ressources with an additional step DX wise

Changes

I added a default-branch param to the CLI. This is due to the fact that extracting the default branch of a repo inside a GitHub Job context is a bit tricky, spent a few hours trying to be smart today, with no luck. Instead of being falsely too smart, I prefer to make it declarative. It defaults to main when not set, but any repo with a default branch different from main shall set this key

Also, another design choice made is to directly push on main branch after the merge commit instead of opening a new PR and skip the merge commits from TinySemVer's logic.

A bit of docs was added but could extend it

Proof of work:

image

P.S: Feel free to test on my fork, you should have write rights.

The recursive is being handled declaratively directly inside your action file, I like it better as it totally skips the job instead of being a silent skip. Users will have to copy it but it is not hard