Skip to content

Commit

Permalink
👷 update changelog template (#90)
Browse files Browse the repository at this point in the history
closes #82
  • Loading branch information
kkharji authored Aug 20, 2021
1 parent 93b0090 commit 3447223
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 13 deletions.
31 changes: 23 additions & 8 deletions .github/chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ $repourl := .Info.RepositoryURL -}}
{{- $repourl := $.Info.RepositoryURL -}}
{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>

Expand All @@ -8,15 +8,30 @@
{{ range .CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}} {{ $subject := .Subject }} {{ if .TrimmedBody }}
<dl><dd><details><summary><a href="{{ $repourl }}/commit/{{ .Hash.Long }}" >{{ .Hash.Short }}</a>: {{ $subject }} {{- range $idx, $ref := .Refs }}{{if not (regexMatch $ref.Ref $subject)}}{{- if $idx }},{{ end }} (<a href="{{ $repourl }}/issues/{{ $ref.Ref }}">#{{ $ref.Ref }}</a>){{ end -}}{{end}}</summary>

{{ .TrimmedBody }}
</details></dd></dl>
{{ else }}
- [{{ .Hash.Short }}]({{ $repourl }}/commit/{{ .Hash.Long }}): {{ $subject }} {{- range $idx, $ref := .Refs }}{{if not (regexMatch $ref.Ref $subject)}}{{- if $idx }},{{ end }} ([#{{ $ref.Ref }}]({{ $repourl }}/issues/{{ $ref.Ref }}){{ end -}}){{end}}{{ end }}
{{ range .Commits -}}
{{- /** Remove markdown urls when there's a pull request linked and replace it with a tag **/ -}}
{{- $subject := (regexReplaceAll `URL` (regexReplaceAll `\[(.*)(\d\d)\]\(.*?\)` .Subject "<a href=\"URL/pull/${2}\">${1}${2}</a>") $repourl) -}}
{{- /** Filter out refs mentioned in the title **/ -}}
{{- $list := (list) -}}
{{- range $idx, $ref := .Refs -}}
{{- if not (regexMatch $ref.Ref $subject) -}}
{{ $list = append $list $ref }}
{{- end -}}
{{- end -}}
{{- /** end custom varaibles **/ -}}

{{ if .TrimmedBody -}}<dl><dd><details><summary>{{ else -}}- {{ end -}}
<a href="{{$repourl}}/commit/{{.Hash.Long}}"><tt>{{.Hash.Short}}</tt></a> {{ $subject }}
{{- if $list -}}
{{ printf " %s " "(closes"}}
{{- range $idx, $ref := $list -}}{{ if $idx }}, {{ end -}}
<a href="{{ $repourl }}/issues/{{ $ref.Ref}}"> #{{ $ref.Ref}}</a>{{ end }})
{{- end -}}
{{ if .TrimmedBody -}}</summary>{{ printf "\n\n%s\n\n" .TrimmedBody }}</details></dd></dl>{{ end }}

{{ end }}
{{ end }}
{{ end -}}

{{- if .RevertCommits -}}
### Reverts
Expand Down
2 changes: 1 addition & 1 deletion .github/chglog/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ options:
bug: ":bug: Bug Fixes"
zap: ":zap: Performance Improvements"
recycle: ":recycle: Code Refactoring"
art: ":art: structure/code formating"
art: ":art: Structure/Formating"
memo: ":memo: Add or update documentation."
white_check_mark: ":white_check_mark: Add/Update Test Cases"
package: ":package: Dependencies"
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Generator Changelog

on:
schedule:
- cron: "0 8 */2 * *"
push:
branches:
- master

jobs:
build-sources:
Expand Down Expand Up @@ -35,7 +36,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_MSG: |
:memo: update CHANGELOG.md
:card_file_box: update CHANGELOG.md
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_MSG: |
:memo: DOC: Update doc/sql.txt
:card_file_box: Update doc/sql.txt
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
Expand Down

0 comments on commit 3447223

Please sign in to comment.