-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (35 loc) · 1.18 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
on:
pull_request:
branches:
- dev
types: [closed]
jobs:
update_changelog:
name: Update and Commit Changelog
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && startsWith( github.event.pull_request.title, '[' )
steps:
# Checkout git.
- uses: actions/checkout@v2
with:
ref: dev # checkout dev branch.
fetch-depth: 0 # fetch all history.
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "Iconibot"
- name: Create Changelog Entry String
run: |
import json
import os
with open('${{ github.event_path }}') as fh:
event = json.load(fh)
escaped = event['pull_request']['title']
with open(os.environ['GITHUB_ENV'], 'a') as fh:
print(f'PR_TITLE={escaped}', file=fh)
shell: python3 {0}
# Update changelog.
- run: |
printf "%b" "$PR_TITLE \n" >> changelog-dev.md
# Commit changes.
- run: git add changelog-dev.md
- run: git commit -m "Update Changelog" || echo "No changes to commit"
- run: git push origin dev