mikepenz/release-changelog-builder-action

[BUG] Failed to retrieve - Invalid tag? - Because of: HttpError: Not Found

cYKatherine opened this issue · 9 comments

image

I got the above error when using mikepenz/release-changelog-builder-action@v4

I know it's similar to #276 but since that's closed I'm moving the discussion to here. I've created two releases with below tags, but it's still showing invalid tag. Can you help me look into this please? Thank you!
image

Good day.

The action likely has no access to those tags. Which token do you provide for it to run?
Please also provide how you configure the action in your CI yaml file?

Hello @mikepenz , thank you so much for the quick response!

      name: Build Docker Changelog
      id: github_release_docker
      if: ${{ inputs.is_release == 'true' && inputs.publish_platform == 'Docker'}}
      uses: mikepenz/release-changelog-builder-action@v4
      with:
        toTag: v${{ inputs.version_number_input }}
        configurationJson: |
          {
            "template": "#{{CHANGELOG}}\n## Installation\n```\ndocker pull ${{ inputs.tags }}\n```\n\n## Image reference to deploy: \n```\n${{ inputs.image_tag }}\n```\n\n## Changelog\n#{{UNCATEGORIZED}}",
            "pr_template": " - #{{TITLE}} - ( PR: ##{{NUMBER}} )"
          }
      env:
        GITHUB_TOKEN: ${{ inputs.github_token }}

Above is my yaml file. I passed in the github_token through inputs as there are several layers of call to pass this through. The github_token value should be legit as I am able to do actions like docker/login-action@v3 using this value.

Thank you.

Yes that should in general work.

The error is thrown by the code here:

failOrError(`💥 Failed to retrieve - Invalid tag? - Because of: ${error}`, failOnError)

And is usually giving Not found if the request does not succeed for the token:
let commits: RestEndpointMethodTypes['repos']['compareCommits']['response']['data']['commits'] = []

the tags are on this repo you execute for? And the token should have read access to pull requests and commits?

In case, please validate the permissions are granted: https://github.com/mikepenz/release-changelog-builder-action?tab=readme-ov-file#token-permission

In my action I have write permission to everything, that should imply read permission as well right?

    runs-on: ubuntu-latest
    permissions:
      contents: write
      security-events: write
      packages: write
      pull-requests: write

The tags are indeed on the repo I execute for:
image

Not really sure what else I'm missing 🤔

Oh I maybe see it.

The action tries to get the diff for 0.10.10 to 0.10.16
Screenshot 2024-01-30 at 19 15 26

However your screenshot shows a 0.10.4 and a 0.10.10 but no 0.10.16

The v0.10.16 is the latest tag we are releasing to: toTag: v${{ inputs.version_number_input }}, I don't think we need to have that to see the changelog?

if you specify the tag it has to exist as tag. If the tag does not exist, you can pass in the git ref (commit sha) instead of the state you want to compare with.

The action fails as it tries to get the state from the toTag you pass, which does not exist.

image You are absolutely right! It works now!! Thank you so much for your help 👍

@cYKatherine awesome news! glad I was able to help.