mikepenz / release-changelog-builder-action

A GitHub action that builds your release notes / changelog fast, easy and exactly the way you want.
https://blog.mikepenz.dev
Apache License 2.0
684 stars 99 forks source link

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

Closed cYKatherine closed 5 months ago

cYKatherine commented 5 months ago
image

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

I know it's similar to https://github.com/mikepenz/release-changelog-builder-action/issues/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
mikepenz commented 5 months ago

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?

cYKatherine commented 5 months ago

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.

mikepenz commented 5 months ago

Thank you.

Yes that should in general work.

The error is thrown by the code here: https://github.com/mikepenz/release-changelog-builder-action/blob/41adfd2e53a2a279c518f395961d266ac37a209a/src/pr-collector/commits.ts#L82 And is usually giving Not found if the request does not succeed for the token: https://github.com/mikepenz/release-changelog-builder-action/blob/41adfd2e53a2a279c518f395961d266ac37a209a/src/repositories/GithubRepository.ts#L21

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

cYKatherine commented 5 months ago

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 🤔

mikepenz commented 5 months ago

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

cYKatherine commented 5 months ago

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?

mikepenz commented 5 months ago

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.

cYKatherine commented 5 months ago
image

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

mikepenz commented 5 months ago

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