Skip to content

gacts/add-to-release-notes

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Add to Release Notes

Release version Build Status License

This action allows you to add content to GitHub release notes programmatically. It can be run on any OS supported by GitHub Actions.

Perfect for automatically appending build artifacts info, Docker image tags, deployment details, or any other dynamic content to your release notes after release creation.

Usage

on:
  release:
    types: [published]

jobs:
  update-release:
    runs-on: ubuntu-latest
    steps:
      - name: Add Docker tags to release notes
        uses: gacts/add-to-release-notes@v1
        with:
          append: |
            ## πŸ‹ Docker images

            ```
            ghcr.io/user/repo:v1.2.3
            ghcr.io/user/repo:latest
            ```

      - name: Prepend important notice
        uses: gacts/add-to-release-notes@v1
        with:
          prepend: |
            > **Warning**
            > This release requires migration steps. See [MIGRATION.md](./MIGRATION.md)

Customizing

Inputs

The following inputs can be used as step.with keys:

Name Type Default Required Description
append string no Content to append (at the end) to the release notes
prepend string no Content to prepend (at the beginning) to the release notes
skip-if-contains string no If the release notes already contain this string/regex, do not modify them
release-id string ${{ github.event.release.id }} no Release ID to update. If not specified, will try to detect from context
tag-name string ${{ github.ref_name }} no Tag name to find release. Used if release-id is not provided
github-token string ${{ github.token }} no GitHub auth token. Since there's a default, this is typically not supplied by the user

Outputs

Name Type Description
updated-body string The updated body content with added release notes

Examples

Append Docker image tags after build

name: Release

on:
  release:
    types: [published]

jobs:
  docker-build:
    runs-on: ubuntu-latest
    outputs:
      tags: ${{ steps.tags.outputs.list }}
    steps:
      - uses: actions/checkout@v5
      - {uses: gacts/github-slug@v1, id: slug}
      - uses: docker/login-action@v3
        with: {registry: ghcr.io, username: '${{ github.actor }}', password: '${{ secrets.GITHUB_TOKEN }}'}
      - id: tags
        env:
          GHCR_IMAGE: ghcr.io/${{ github.repository }}
          EXACT: ${{ steps.slug.outputs.version-semantic }}
          MINOR: ${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }}
          MAJOR: ${{ steps.slug.outputs.version-major }}
        run: |
          echo 'list<<EOF' >> $GITHUB_OUTPUT
          echo "$GHCR_IMAGE:$EXACT" >> "$GITHUB_OUTPUT"
          echo "$GHCR_IMAGE:$MINOR" >> "$GITHUB_OUTPUT"
          echo "$GHCR_IMAGE:$MAJOR" >> "$GITHUB_OUTPUT"
          echo "$GHCR_IMAGE:latest" >> "$GITHUB_OUTPUT"
          echo 'EOF' >> $GITHUB_OUTPUT
      - uses: docker/build-push-action@v6
        id: push
        with:
          context: .
          file: Dockerfile
          push: true
          tags: ${{ steps.tags.outputs.list }}

  update-release:
    runs-on: ubuntu-latest
    needs: [docker-build]
    steps:
      - uses: gacts/add-to-release-notes@v1
        with:
          append: |
            ## πŸ‹ Docker images

            ```
            ${{ needs.docker-build.outputs.tags }}
            ```
          skip-if-contains: "## πŸ‹ Docker images"

Prepend and append content

- uses: gacts/add-to-release-notes@v1
  with:
    prepend: |
      > **Note**
      > Breaking changes in this release!
    append: |
      ## πŸ“¦ Assets

      - `app-linux-amd64`
      - `app-darwin-arm64`

Skip update if content already exists

- uses: gacts/add-to-release-notes@v1
  with:
    append: |
      ## Deployment info
      Deployed to production at ${{ github.event.release.created_at }}
    skip-if-contains: "Deployment info"

Using regex pattern for skip condition

- uses: gacts/add-to-release-notes@v1
  with:
    append: "## Build #${{ github.run_number }}"
    skip-if-contains: '## Build #\d+'

Update specific release by tag

- uses: gacts/add-to-release-notes@v1
  with:
    tag-name: v1.2.3
    append: |
      ## Hotfix applied
      Security patch included

Update specific release by ID

- uses: gacts/add-to-release-notes@v1
  with:
    release-id: 123456789
    prepend: "⚠️ **Deprecated:** This release is no longer supported"

Releasing

To release a new version:

  • Build the action distribution (make build or npm run build).
  • Commit and push changes (including dist directory changes - this is important) to the master|main branch.
  • Publish the new release using the repo releases page (the git tag should follow the vX.Y.Z format).

Major and minor git tags (v1 and v1.2 if you publish a v1.2.Z release) will be updated automatically.

Tip

Use Dependabot to keep this action updated in your repository.

Support

Issues Pull Requests

If you find any errors in the action, please create an issue in this repository.

License

This is open-source software licensed under the MIT License.

About

πŸš€ This action allows you to add content to GitHub release notes programmatically

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •