Automate README generation with GitHub Actions

- Add `generate-readme.yml` workflow to update `README.md` on pushes to `main` when `_README.md` changes
- Introduce AWK scripts as a submodule (`scripts/awk`) for processing the README
- Rename `README.md` to `_README.md` to serve as the source file
This commit is contained in:
Anas Sheashaey 2024-11-10 03:52:16 +02:00
parent 0d85dc34cc
commit b17c5ff981
4 changed files with 39 additions and 0 deletions

34
.github/workflows/generate-readme.yml vendored Normal file
View File

@ -0,0 +1,34 @@
name: Update README
on:
push:
branches:
- main
paths:
- '_README.md'
jobs:
update-readme:
if: ${{ github.actor != 'github-actions[bot]' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up dependencies
run: |
sudo apt-get update
sudo apt-get install -y gawk
- name: Generate README.md
run: |
awk -f scripts/awk/addGithubShields.awk _README.md | awk -f scripts/awk/makeShieldsSquare.awk > README.md
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'Auto-update README.md [skip ci]'
file_pattern: README.md

4
.gitmodules vendored Normal file
View File

@ -0,0 +1,4 @@
[submodule "scripts/awk"]
path = scripts/awk
url = https://github.com/she3o/AWKward
branch = for-awesome-zotero

1
scripts/awk Submodule

@ -0,0 +1 @@
Subproject commit 9546dc0876ae7ac402395bdcfdd9dd9f5f521ae1