Skip to content

Commit

Permalink
feat: add readme updater
Browse files Browse the repository at this point in the history
  • Loading branch information
aeimer committed Oct 24, 2023
1 parent 907d811 commit 8e4d2da
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
20 changes: 20 additions & 0 deletions .ci-scripts/update-toc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail

# Enable debug - print commands
#set -x

function generateToc() {
echo "* TODO"
return
# while read -r file; do
# adrNumber=$(cut -d- -f1 <<<"$file")
# adrTitle=$(sed '/---/,/---/d' "$file" | sed -En 's/^# (.+)$/\1/p' | head -1)
# 1>&2 echo " - $file => ($adrNumber) $adrTitle"
# printf -- "* [ADR-%s](%s) - %s\n" "$adrNumber" "$file" "$adrTitle"
# done < <(find . -maxdepth 1 -type f -regex '\./[0-9]+-.*\.md' -exec basename {} \; | sort)
}

echo "Generating TOC in README.md"
# https://stackoverflow.com/questions/2699666/replace-delimited-block-of-text-in-file-with-the-contents-of-another-file
sed -i -ne '/<!-- BEGIN TOC -->/ {p; r '<(generateToc) -e ':a; n; /<!-- END TOC -->/ {p; b}; ba}; p' README.md
4 changes: 3 additions & 1 deletion .github/workflows/create-aliases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ jobs:
run: .ci-scripts/parse-formulas.sh
- name: Generate Aliases
run: .ci-scripts/generate-aliases.sh
- name: Update TOC
run: .ci-scripts/update-toc.sh
- name: Commit & Push changes
run: |
git config --global user.name 'QAware Homebrew Bot'
git config --global user.email 'qaware.homebrew.bot@qaware.de'
git add Aliases
git add Aliases README.md
git commit --quiet -m "chore: update Aliases" || {
echo "Nothing to commit or commit failed, will exit now"
exit 0
Expand Down
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,17 @@ brew install protocurl
brew install qaware/tap/protocurl
```

<!-- TODO: Add auto updating (CI) list here with supplied Formalae -->
<!-- TODO: Add CI that creates Aliases to the latest versioned Formulae -->
## Content

<!-- BEGIN TOC -->
<!-- END TOC -->

## Formulae maintainer

If you want to push your own `Formulae` these are the steps:

* Get a `Deploy Token` for your repo/CI (can be requested by the maintainers of this tap-repo)

## Maintainers

* Alexander Eimer (@qa-alexander-eimer)

0 comments on commit 8e4d2da

Please sign in to comment.