feat: Enhance release notes generation with optional tag input and workflow adjustments#62
Conversation
…rkflow adjustments
There was a problem hiding this comment.
Pull Request Overview
This pull request integrates automated release notes generation into the release pipeline by adding workflow_call support to the release notes generator and invoking it from the main release workflow.
Key changes:
- Added
workflow_calltrigger with optionaltaginput parameter to the release notes generator workflow - Enhanced tag determination logic to prioritize input parameter, then fall back to release event or most recent tag
- Integrated release notes generation as a dependent job in the release build workflow
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
.github/workflows/release-notes-generator.yml |
Added workflow_call trigger with optional tag input, removed released event type, refactored tag determination logic to support multiple trigger scenarios |
.github/workflows/release-build.yml |
Added new release-notes job that calls the release notes generator workflow after successful release, passing the tag and inheriting secrets |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| TAG_NAME="${{ inputs.tag }}" | ||
| if [[ -z "${TAG_NAME}" && "${{ github.event_name }}" == "release" ]]; then | ||
| TAG_NAME="${{ github.event.release.tag_name }}" | ||
| else | ||
| # workflow_dispatch - use most recent tag by creation date | ||
| fi | ||
|
|
||
| if [[ -z "${TAG_NAME}" && "${{ github.event_name }}" == "workflow_dispatch" ]]; then | ||
| TAG_NAME="$(git tag --sort=-creatordate | head -n 1 || true)" | ||
| fi |
There was a problem hiding this comment.
The tag determination logic doesn't handle the workflow_call event properly. When triggered via workflow_call, the github.event_name will be "workflow_call", not "release" or "workflow_dispatch". If no tag input is provided (which is allowed since required: false), both conditions on lines 51 and 55 will be false, causing the workflow to exit with an error on line 61.
Consider adding a fallback for the workflow_call case:
if [[ -z "${TAG_NAME}" ]]; then
# Fallback to most recent tag for workflow_call or other triggers
TAG_NAME="$(git tag --sort=-creatordate | head -n 1 || true)"
fiThis would make the workflow more robust, even though the current caller always provides a tag.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| release-notes: |
There was a problem hiding this comment.
The release-notes job will run even when the release job is skipped due to the condition if: startsWith(github.ref, 'refs/tags/'). When triggered by workflow_dispatch without a tag (where github.ref would be a branch), the release job will be skipped, but release-notes will still attempt to run and call the release-notes-generator workflow.
Consider adding the same condition to the release-notes job:
release-notes:
if: startsWith(github.ref, 'refs/tags/')
needs: release
uses: ./.github/workflows/release-notes-generator.yml
with:
tag: ${{ github.ref_name }}
secrets: inherit| release-notes: | |
| release-notes: | |
| if: startsWith(github.ref, 'refs/tags/') |
| if [[ -z "${TAG_NAME}" && "${{ github.event_name }}" == "workflow_dispatch" ]]; then | ||
| TAG_NAME="$(git tag --sort=-creatordate | head -n 1 || true)" | ||
| fi | ||
|
|
||
| # Fallback for workflow_call or any other trigger if tag was not provided/resolved |
There was a problem hiding this comment.
The logic has redundancy that could be simplified. Lines 55-57 and 60-62 have identical fallback logic. The condition on line 55 will never be true when line 60 is reached because if TAG_NAME is empty and the event is workflow_dispatch, it will be set on line 56, making the second fallback unreachable for that specific case.
Consider simplifying to:
TAG_NAME="${{ inputs.tag }}"
if [[ -z "${TAG_NAME}" && "${{ github.event_name }}" == "release" ]]; then
TAG_NAME="${{ github.event.release.tag_name }}"
fi
# Fallback to most recent tag for workflow_dispatch, workflow_call, or if tag not provided/resolved
if [[ -z "${TAG_NAME}" ]]; then
TAG_NAME="$(git tag --sort=-creatordate | head -n 1 || true)"
fi| if [[ -z "${TAG_NAME}" && "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| TAG_NAME="$(git tag --sort=-creatordate | head -n 1 || true)" | |
| fi | |
| # Fallback for workflow_call or any other trigger if tag was not provided/resolved | |
| # Fallback to most recent tag for workflow_dispatch, workflow_call, or if tag not provided/resolved |
| workflow_dispatch: | ||
| workflow_call: | ||
| inputs: | ||
| tag: |
There was a problem hiding this comment.
[nitpick] The tag input is missing a description field. While not strictly required, adding a description improves workflow documentation and helps users understand the input's purpose.
Consider adding:
workflow_call:
inputs:
tag:
description: 'Release tag to generate notes for. If not provided, uses the release event tag or the most recent tag.'
required: false
type: string| tag: | |
| tag: | |
| description: 'Release tag to generate notes for. If not provided, uses the release event tag or the most recent tag.' |
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request updates the release workflow to automate and streamline the generation of release notes. The main changes involve integrating the release notes generation workflow into the main release pipeline and enhancing its flexibility to handle different triggering scenarios.
Release workflow integration and improvements:
release-notesjob to.github/workflows/release-build.ymlthat runs after the main release job and calls the release notes generator workflow, passing the release tag and inheriting secrets.Release notes workflow enhancements:
.github/workflows/release-notes-generator.ymlto support invocation viaworkflow_call, allowing the workflow to be triggered from other workflows and to accept an optionaltaginput.