This github action fetches titles of pull requests between latest release and branch's HEAD and creates changelog from them.
Input | Description | Example | Default | Required |
---|---|---|---|---|
github_token | github personal access token | ghe_xyz |
NO DEFAULT PROVIDED | yes |
branch | base branch of pull request | main |
repositories default branch | no |
title | changelog title | Changelog |
date YYYY/MM/DD |
no |
prefix | prefix of pull request title in changelog | * |
- |
no |
owner | owner or organization of repository | dragonraid |
GITHUB_REPOSITORY environment variable (part before / ) |
no |
repo | repository | changelog-emitter |
GITHUB_REPOSITORY environment variable (part after / ) |
no |
Output | Description |
---|---|
changelog | text of changelog |
isEmpty | whether text of changelog is empty |
Text of changelog can also be accessed in subsequent steps via CHANGELOG
environment variable.
This example, together with other useful github actions, creates new release with pull requests titles as release's body.
name: release
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Create changelog
id: changelog
uses: dragonraid/changelog-emitter
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Bump tag
if: steps.changelog.outputs.isEmpty == false
id: tag
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
release_branches: main
default_bump: minor
- name: Create github release
if: steps.changelog.outputs.isEmpty == false
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `${{ steps.tag.outputs.new_tag }}`,
name: `${{ steps.tag.outputs.new_tag }}`,
body: `${{ steps.changelog.outputs.changelog }}`,
});