-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (30 loc) · 1.04 KB
/
streak_readme.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
name: Edit README based on Commit Message
on:
push:
branches:
- main
jobs:
edit_readme:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Extract Commit Message
id: extract_commit_message
run: echo "::set-output name=message::$(git log --format=%B -n 1 ${{ github.sha }})"
- name: Parse Commit Message
id: parse_commit_message
run: echo "::set-output name=ct_number::$(echo ${{ steps.extract_commit_message.outputs.message }} | grep -oP 'CT_\K\d+')"
- name: Edit README
run: |
ct_number="${{ steps.parse_commit_message.outputs.ct_number }}"
if [ -n "$ct_number" ]; then
sed -i "1s/.*/# :rocket: 스트릭 [${ct_number}] 일/" README.md
fi
- name: Commit Changes
run: |
git config user.name 'GitHub Actions'
git config user.email '<>'
git add README.md
git commit -m "Update README based on commit message"
git push