Skip to content

Commit

Permalink
feat: add generate release notes action
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanosdev committed Nov 25, 2024
1 parent 220abbf commit a3a4609
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Shared GitHub workflows and actions for DFINITY repositories.
- [Check pull request title](./actions/check-pr-title/README.md)
- [Create pull request](./actions/create-pr/README.md)
- [Generate changelog](./actions/generate-changelog/README.md)
- [Generate release notes](./actions/generate-release-notes/README.md)
- [Setup Commitizen](./actions/setup-commitizen/README.md)
- [Setup pnpm](./actions/setup-pnpm/README.md)
- [Setup Python](./actions/setup-python/README.md)
Expand Down
41 changes: 41 additions & 0 deletions actions/generate-release-notes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Generate release notes

This action generates release notes based on the repository's commit messages according to the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/). It assumes [Python](https://www.python.org/), [pip](https://pip.pypa.io/en/stable/) and [Commitizen](https://commitizen-tools.github.io/commitizen/) are already setup, see the [setup Python action](../setup-python/README.md) and [setup Commitizen action](../setup-commitizen/README.md) for ready to use actions to do this.

## Action inputs

| Input | Description | Default |
| ----------- | --------------------------------------------------- | ------------------------ |
| `file_name` | The name of the file to write the release notes to. | `'RELEASE_NOTES.md'` |
| `version` | The version to generate release notes for. | `${{ github.ref_name }}` |

## Example usage

```yaml
name: 'Generate release notes'

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:
generate_release_notes:
runs-on: ubuntu-latest
steps:
- name: 'Checkout repository'
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 'Setup Python'
uses: dfinity/ci-tools/actions/setup-python@main

- name: 'Setup Commitizen'
uses: dfinity/ci-tools/actions/setup-commitizen@main

- name: 'Generate release notes'
uses: dfinity/ci-tools/actions/generate-release_notes@main
with:
file_name: 'RELEASE.md'
```
20 changes: 20 additions & 0 deletions actions/generate-release-notes/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 'Generate release notes'
description: 'This action generates release notes based on the repository's commit messages written according to the Conventional Commits specification.'

inputs:
file_name:
description: 'The name of the file to write the release notes to.'
required: false
default: 'RELEASE_NOTES.md'

version:
description: 'The release version to generate release notes for.'
required: false
default: ${{ github.ref_name }}

runs:
using: 'composite'
steps:
- name: 'Generate changelog'
shell: bash
run: cz changelog ${{ inputs.version }} --file-name="${{ inputs.file_name }}"

0 comments on commit a3a4609

Please sign in to comment.