Skip to content

Update plugin list in README #1

Update plugin list in README

Update plugin list in README #1

name: Update plugin list in README
on:
# twice per month (2:15 at the 2nd and 15th of the month)
schedule:
- cron: "15 2 2,15 * *"
# allow triggering manually
workflow_dispatch:
permissions:
contents: write
#───────────────────────────────────────────────────────────────────────────────
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Update plugin list
run: |
# config
nvim_readme="./nvim/README.md"
last_line_before_plugins="## All installed plugins"
lazy_lock="./nvim/.lazy-lock.json"
lazy_specs_path="./nvim/lua/plugins"
# 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"/** | # all plugin repos
sort --ignore-case | uniq |
sed -E 's|.*|- [&](https://github.com/&)|' \
>> "$nvim_readme"
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "chore: auto-update plugin list"