-
-
Notifications
You must be signed in to change notification settings - Fork 5
52 lines (46 loc) · 1.41 KB
/
changelog.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
name: Update CHANGELOG.md
on:
push:
branches:
- "main"
workflow_dispatch:
jobs:
changelog:
runs-on: ubuntu-20.04
steps:
- name: Check out repository
uses: actions/checkout@v4.2.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Generate a changelog
uses: orhun/git-cliff-action@v4.4.1
with:
config: cliff.toml
args: --verbose
env:
OUTPUT: CHANGELOG.md
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6.2.0
with:
gpg_private_key: ${{ secrets.GIT_ACTIONS_GPG_KEY }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Commit and push changes
run: |
if [[ `git status --porcelain` ]]; then
COMMIT_AUTHOR=$(git log -1 --pretty=%an)
if [[ "$COMMIT_AUTHOR" != "Gitbot-Actions" ]]; then
git config --global user.name ${{ secrets.GIT_NAME }}
git config --global user.email ${{ secrets.GIT_EMAIL }}
git add -u
git commit -m "chore(changelog): Update CHANGELOG.md"
git push origin main
else
echo "WARNING: $COMMIT_AUTHOR last committed."
fi
else
echo "WARNING: No changes were detected."
fi
shell: bash