From b17c5ff9817bf37a2324cd92267ac38011e1b788 Mon Sep 17 00:00:00 2001 From: Anas Sheashaey Date: Sun, 10 Nov 2024 03:52:16 +0200 Subject: [PATCH] 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 --- .github/workflows/generate-readme.yml | 34 +++++++++++++++++++++++++++ .gitmodules | 4 ++++ README.md => _README.md | 0 scripts/awk | 1 + 4 files changed, 39 insertions(+) create mode 100644 .github/workflows/generate-readme.yml create mode 100644 .gitmodules rename README.md => _README.md (100%) create mode 160000 scripts/awk diff --git a/.github/workflows/generate-readme.yml b/.github/workflows/generate-readme.yml new file mode 100644 index 0000000..0a04b06 --- /dev/null +++ b/.github/workflows/generate-readme.yml @@ -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 + diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..376c945 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "scripts/awk"] + path = scripts/awk + url = https://github.com/she3o/AWKward + branch = for-awesome-zotero diff --git a/README.md b/_README.md similarity index 100% rename from README.md rename to _README.md diff --git a/scripts/awk b/scripts/awk new file mode 160000 index 0000000..9546dc0 --- /dev/null +++ b/scripts/awk @@ -0,0 +1 @@ +Subproject commit 9546dc0876ae7ac402395bdcfdd9dd9f5f521ae1