Skip to content

Commit

Permalink
feat: Generate CHANGELOG.md automatically (#1368)
Browse files Browse the repository at this point in the history
Signed-off-by: makocchi-git <[email protected]>
  • Loading branch information
makocchi-git authored Oct 6, 2021
1 parent a1af470 commit 327bdf7
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/changelog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Changelog

on:
push:
tags:
- v*
- "!v.0.9"
jobs:
generate_changelog:
if: github.repository == 'argoproj/argo-events'
runs-on: ubuntu-latest
name: Generate changelog
steps:
- uses: actions/checkout@v2
with:
ref: master
fetch-depth: 0
- run: git fetch --prune --prune-tags
- run: git tag -l 'v*'
# avoid invoking `make` to reduce the risk of a Makefile bug failing this workflow
- run: ./hack/changelog.sh > CHANGELOG.md
- uses: peter-evans/create-pull-request@v3
with:
title: 'docs: updated CHANGELOG.md'
commit-message: 'docs: updated CHANGELOG.md'
signoff: true

23 changes: 23 additions & 0 deletions hack/changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env sh
set -eu

echo '# Changelog'
echo

tag=
# we skip v.0.9 tags, so these can be used on branches without updating release notes
git tag -l 'v*' | grep -v v.0.9 | sed 's/-rc/~/' | sort -rV | sed 's/~/-rc/' | while read last; do
if [ "$tag" != "" ]; then
echo "## $(git for-each-ref --format='%(refname:strip=2) (%(creatordate:short))' refs/tags/${tag})"
echo
git_log='git --no-pager log --no-merges --invert-grep --grep=^\(build\|chore\|ci\|docs\|test\):'
$git_log --format=' * [%h](https://github.com/argoproj/argo-events/commit/%H) %s' $last..$tag
echo
echo "### Contributors"
echo
$git_log --format=' * %an' $last..$tag | sort -u
echo
fi
tag=$last
done

0 comments on commit 327bdf7

Please sign in to comment.