-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (41 loc) · 1.23 KB
/
generate_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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Rebuild README.md if necessary
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Getting the sources
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
- name: Check for prefix in commit messages
id: check_prefix
continue-on-error: true
run: |
git log --format=%B -n 1 $GITHUB_SHA | grep -Eq "^(feat|refactor):"
echo "prefix_found=1" >> $GITHUB_OUTPUT
- name: Prepare Node
uses: actions/setup-node@v4
if: steps.check_prefix.outputs.prefix_found == '1'
with:
node-version: 20
- name: Build README.md
if: steps.check_prefix.outputs.prefix_found == '1'
run: |
tmpfile=$(mktemp)
pushd build
npm ci
node build_readme.js > "$tmpfile"
popd
mv "$tmpfile" README.md
- name: Push the generated README.md
uses: EndBug/add-and-commit@v9
if: steps.check_prefix.outputs.prefix_found == '1'
with:
author_name: 🤖 CompileBot
author_email: CompileBot@happyrobots.com
message: 'chore: update README.md'
add: 'README.md'