Skip to content

Release notes contain more commits than are included in the release #593

@julianna-boompop

Description

@julianna-boompop

Describe the bug

When this GitHub Action goes to create a release, it generates the release notes before creating the release (tag). And when it makes the GitHub API call to generate the release notes, it only passes in the release tag (which doesn't exist yet), and (importantly) it doesn't support the additional optional body parameters that would allow us to tell the GitHub API where the tag is intended to be (i.e. the "optional" target_commitish body parameter) so it defaults to the latest commit.

Relevant Code:

    private async createRelease() {
        const releaseBody = await this.combineBodyWithReleaseNotes(this.inputs.createdReleaseBody, false)

        // If immutableCreate is enabled we need to start with a draft release
        const draft = this.inputs.createdDraft || this.inputs.immutableCreate

        const releaseResponse = await this.releases.create(

Source: ncipollo/release-action createRelease snippet

    async generateReleaseNotes(tag: string, previousTag?: string): Promise<GenerateReleaseNotesResponse> {
        const params: any = {
            owner: this.inputs.owner,
            repo: this.inputs.repo,
            tag_name: tag,
        }
        
        if (previousTag) {
            params.previous_tag_name = previousTag
        }
        
        return this.git.rest.repos.generateReleaseNotes(params)
    }

Source: ncipollo/release-action generateReleaseNotes

Documentation:

target_commitish string
Specifies the commitish value that will be the target for the release's tag. Required if the supplied tag_name does not reference an existing tag. Ignored if the tag_name already exists.

Source: GitHub API Docs: Generate release notes content for a release

To Reproduce

Steps to reproduce the behavior:

  1. Merge a commit that (eventually) kicks off this GitHub action, including a commit, generateReleaseNotes as true, and a tag. Example workflow yml snippet:
      - name: 🆕 Create Release
        uses: ncipollo/release-action@v1
        with:
          commit: ${{ github.event.workflow_run.head_sha || github.sha }}
          generateReleaseNotes: true
          makeLatest: true
          omitName: true
          skipIfReleaseExists: true
          tag: ${{ env.RELEASE_DATE }}.${{ github.run_id }}
          token: ${{ secrets.CREATE_RELEASE_ACCESS_TOKEN }}
  1. Merge a commit while the chain reaction of GHA from the previous step hasn't completed (or created release notes) yet.
  2. Observe the release tag is linked to the correct commit, but the release notes contains changes created after the commit.

Screenshots

Release notes vs Release tag diff
Image

Expected behavior

Call the GitHub API to generate the release notes needs to also include target_commitish to create the release notes for the changes up to and including the release tagged commit, and not contain commits that came after.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions