Skip to content

Fetch commits from non-default branches on GitHub #1050

@william-stacken

Description

@william-stacken

Is there an existing issue or pull request for this?

  • I have searched the existing issues and pull requests

Feature description

When the GitHub remote is used (and potentially for other remotes as well) the commits are fetched only from the default branch. To fetch commits from an arbitrary branch, one can use the sha query parameter when calling GitHub's API. git-cliff does not give this parameter, which means that the sha falls back to the default branch.

Desired solution

Parse the git RANGE argument given to git cliff and set the sha query param to the head of the range. For example, if the range is v1.0..v1.1, then the URL used to fetch commits becomes https://api.github.com/repos/owner/repo/commits?per_page={MAX_PAGE_SIZE}&page={page}&sha=v1.1

Alternatives considered

Create a separate cli argument, for example --commit-head, that can be used to set the sha query param instead of parsing the RANGE. Or perhaps some general solution that allows the user to configure the API calls that git cliff issues.

Additional context

We are using the trunk-based workflow while developing, which means that we occationally create hotfix branches that we create releases from. We would then like to generate release notes for this "hotfix release".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions