-
Notifications
You must be signed in to change notification settings - Fork 59
58 lines (50 loc) · 1.64 KB
/
auto-changelog-generator.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Generate Changelog
on:
# Manual trigger only
workflow_dispatch:
inputs:
branch:
description: 'Branch name'
required: true
jobs:
generate-changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
- name: Install github-changelog-generator
run: gem install github_changelog_generator
- name: Generate Changelog
run: |
github_changelog_generator \
-u ${{ github.repository_owner }} \
-p ${{ github.event.repository.name }} \
--token ${{ secrets.GITHUB_TOKEN }} \
--output CHANGELOG.md
- name: Commit updated CHANGELOG.md
id: commit
run: |
git add CHANGELOG.md
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
if git diff --quiet && git diff --staged --quiet; then
echo "No changes in CHANGELOG.md, skipping commit."
echo "commit_status=skipped" >> $GITHUB_ENV
else
git commit -m "Update CHANGELOG.md"
echo "commit_status=committed" >> $GITHUB_ENV
fi
- name: Echo CHANGELOG.md
run: cat CHANGELOG.md
- name: Push changes
if: env.commit_status == 'committed'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.event.inputs.branch }}