Skip to content

Update plugin list in README #96

Update plugin list in README

Update plugin list in README #96

name: Update plugin list in README
on:
schedule:
- cron: "15 2 * * 3" # once per week on Wednesday
push:
branches: [main]
paths: [.github/workflows/update-plugin-list.yaml]
workflow_dispatch: {} # enables manual triggering
permissions:
contents: write
#───────────────────────────────────────────────────────────────────────────────
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v6
- name: Update plugin list
run: |
# CONFIG
last_line_before_plugins="<!-- auto-generate list -->"
nvim_readme="./nvim/README.md"
lazy_lock="./nvim/.lazy-lock.json"
lazy_specs_path="./nvim/lua/plugin-specs"
if [[ ! -f "$nvim_readme" || ! -f "$lazy_lock" || ! -d "$lazy_specs_path" ]]; then
echo "ERROR: missing files"
exit 1
fi
# remove old lines
sed -i '' -n "1,/$last_line_before_plugins/p" "$nvim_readme"
# determine all installed plugins
sed '1d;$d' "$lazy_lock" | cut -d'"' -f2 | # all plugin names
xargs -I {} grep --only-matching --no-filename --max-count=1 \
--regexp "[A-Za-z0-9_-]\+/"{}'"' "$lazy_specs_path"/*.lua | # all plugin repos
cut -d'"' -f1 |
sort --ignore-case | uniq |
sed -E 's|.*|- [&](https://github.com/&)|' \
>> "$nvim_readme"
- name: auto-commit
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "bot: auto-update plugin list"