-
Notifications
You must be signed in to change notification settings - Fork 232
Description
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_commitishstring
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:
- Merge a commit that (eventually) kicks off this GitHub action, including a
commit,generateReleaseNotesas true, and atag. 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 }}
- Merge a commit while the chain reaction of GHA from the previous step hasn't completed (or created release notes) yet.
- 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

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.