diff --git a/actions/changelog-generate/action.yaml b/actions/changelog-generate/action.yaml index b4f339188..cb5ae1740 100644 --- a/actions/changelog-generate/action.yaml +++ b/actions/changelog-generate/action.yaml @@ -9,6 +9,10 @@ inputs: description: Version after bump required: true # optional inputs + range: + description: "The range of commits to include in the changelog. (by default from last tagged commit that is not HEAD to HEAD) accepts any git revision range." + required: false + default: "" changelog-file: description: Path to the changelog file in the GitHub repository required: false @@ -29,6 +33,9 @@ outputs: single-changelog: description: "Only the latest changelog." value: ${{ steps.git-cliff-latest.outputs.content }} + ranged-changelog: + description: "Only the changelog for the specified range. (by default from last tagged commit that is not HEAD to HEAD)" + value: ${{ steps.git-cliff-latest.outputs.content }} runs: using: "composite" @@ -48,13 +55,23 @@ runs: else cp $DEFAULT_PATH tmp_cliff.toml fi + echo "default_commit_range=$(git describe --tags --exclude=$(git tag --points-at HEAD) --abbrev=0)..HEAD" >> $GITHUB_OUTPUT shell: bash + - name: Generate range only changelog + uses: orhun/git-cliff-action@v3 + id: git-cliff-range + with: + config: tmp_cliff.toml + args: ${{ inputs.range == '' && steps.get-config-path.outputs.default_commit_range || inputs.range }} + env: + GITHUB_REPO: ${{ github.repository }} + GITHUB_TOKEN: ${{ inputs.github-token }} - name: Generate latest only changelog uses: orhun/git-cliff-action@v3 id: git-cliff-latest with: config: tmp_cliff.toml - args: "--unreleased --tag ${{ inputs.tag }} --verbose" + args: "--unreleased --tag ${{ inputs.tag }}" env: GITHUB_REPO: ${{ github.repository }} GITHUB_TOKEN: ${{ inputs.github-token }} @@ -63,7 +80,7 @@ runs: id: git-cliff with: config: tmp_cliff.toml - args: "--tag ${{ inputs.tag }} --verbose" + args: "--tag ${{ inputs.tag }}" env: OUTPUT: ${{ inputs.changelog-file }} GITHUB_REPO: ${{ github.repository }} diff --git a/docs/actions/changelog-generate/README.md b/docs/actions/changelog-generate/README.md index 700f3c5dc..501ee54bd 100644 --- a/docs/actions/changelog-generate/README.md +++ b/docs/actions/changelog-generate/README.md @@ -86,13 +86,14 @@ steps: -| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION | -| -------------- | ------ | -------- | ---------------- | --------------------------------------------------- | -| changelog-file | string | false | `"CHANGELOG.md"` | Path to the changelog file in the GitHub repository | -| checkout | string | false | `"false"` | Whether to checkout the repository or not. | -| clean | string | false | `"false"` | Clean the repository before running the action. | -| github-token | string | true | | The GitHub token for committing the changes. | -| tag | string | true | | Version after bump | +| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION | +| -------------- | ------ | -------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | +| changelog-file | string | false | `"CHANGELOG.md"` | Path to the changelog file in the GitHub repository | +| checkout | string | false | `"false"` | Whether to checkout the repository or not. | +| clean | string | false | `"false"` | Clean the repository before running the action. | +| github-token | string | true | | The GitHub token for committing the changes. | +| range | string | false | | The range of commits to include in the changelog. (by default from last tagged commit that is not HEAD to HEAD) accepts any git revision range. | +| tag | string | true | | Version after bump | @@ -100,10 +101,11 @@ steps: -| OUTPUT | TYPE | DESCRIPTION | -| ---------------- | ------ | -------------------------- | -| merged-changelog | string | All changelogs combined. | -| single-changelog | string | Only the latest changelog. | +| OUTPUT | TYPE | DESCRIPTION | +| ---------------- | ------ | --------------------------------------------------------------------------------------------------------- | +| merged-changelog | string | All changelogs combined. | +| ranged-changelog | string | Only the changelog for the specified range. (by default from last tagged commit that is not HEAD to HEAD) | +| single-changelog | string | Only the latest changelog. |