diff --git a/.ci-scripts/update-toc.sh b/.ci-scripts/update-toc.sh deleted file mode 100755 index 662cb07..0000000 --- a/.ci-scripts/update-toc.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# Enable debug - print commands -#set -x - -function generateToc() { - programNameList=() - - while read -r file; do - programName=$(cut -d@ -f1 <<<"$file" | sed 's/.rb//') - programNameList+=("$programName") - done < <(find "Formula" -maxdepth 1 -type f -name '*.rb' -exec basename {} \; | sort) - - if [[ ${#programNameList[@]} == "0" ]]; then - programNameList=("_n/a (no formula found)_") - fi - - printf "* %s\n" "${programNameList[@]}" | sort -u -} - -echo "Generating TOC in README.md" -toc=$(generateToc) -echo "$toc" -# https://stackoverflow.com/questions/2699666/replace-delimited-block-of-text-in-file-with-the-contents-of-another-file -sed -i -ne '// {p; r '<(cat <<<"$toc") -e ':a; n; // {p; b}; ba}; p' README.md diff --git a/.github/workflows/update-toc.yml b/.github/workflows/update-toc.yml index 5b75f89..8932b76 100644 --- a/.github/workflows/update-toc.yml +++ b/.github/workflows/update-toc.yml @@ -18,7 +18,7 @@ jobs: uses: actions/checkout@v4 - name: Update TOC - run: .ci-scripts/update-toc.sh + uses: qaware/update-brew-tap-toc-action@main - name: Commit & Push changes env: