Skip to content

Commit

Permalink
ci: add generate_readme.yml workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dplocki committed Jun 24, 2024
1 parent 6fd8de2 commit 5dcf15d
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/generate_readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
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

- name: Check for prefix in commit messages
id: check_prefix
continue-on-error: true
run: |
git log --format=%B -n 1 $GITHUB_SHA | grep -q "^(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'

0 comments on commit 5dcf15d

Please sign in to comment.