ietf-tools / semver-action

GitHub Action to calculate the next release version based on conventional commits
BSD 3-Clause "New" or "Revised" License
56 stars 22 forks source link

prefix not working properly? #31

Closed jbakholt closed 11 months ago

jbakholt commented 1 year ago

I have a repository tagged with x/v1.0.0

Now when configuring semver-action like this:

  - name: Get Next Version
    id: semver
    uses: ietf-tools/semver-action@v1.5.1
    with:
      token: ${{ github.token }}
      branch: main
      noVersionBumpBehavior: current
      prefix: x/

I get this:

Run ietf-tools/semver-action@v1.5.1 with: token: *** branch: main noVersionBumpBehavior: current prefix: x/ minorList: feat, feature patchList: fix, bugfix, perf, refactor, test, tests patchAll: false skipInvalidTags: false Comparing against latest tag: x/v1.0.0 /home/runner/work/_actions/ietf-tools/semver-action/v1.5.1/dist/index.js:4998 const error = new requestError.RequestError(toErrorMessage(data), status, { ^

RequestError [HttpError]: Not Found at /home/runner/work/_actions/ietf-tools/semver-action/v1.5.1/dist/index.js:4998:21 at processTicksAndRejections (node:internal/process/task_queues:96:5) at async main (/home/runner/work/_actions/ietf-tools/semver-action/v1.5.1/dist/index.js:31171:24) { status: 404,

What am I doing wrong? If I omit the prefix i get "Latest tag is invalid (does not conform to semver)!"

So clearly the prefix does something...

marcammann commented 1 year ago

I think what's happening is that when the URL for the Github API is generated, it already removed the prefix from the tag?

So if you have a tag myapp/1.0.0 and you specify a prefix of myapp/ then the API call to Github to get the changes looks for 1.0.0...main instead of myapp/1.0.0...main.

Guessing ${prefix} has to be added to Line 135 when fetching the raw commits.

galenwarren commented 11 months ago

I ran into the same issue and @marcammann is right about the necessary change. I created a PR for this: https://github.com/ietf-tools/semver-action/pull/35.