Update plugin list in README #34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | |
| permissions: | |
| contents: write | |
| #─────────────────────────────────────────────────────────────────────────────── | |
| jobs: | |
| build: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Update plugin list | |
| run: | | |
| # CONFIG | |
| last_line_before_plugins="## All installed plugins" | |
| 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"/** | # all plugin repos | |
| sort --ignore-case | uniq | | |
| sed -E 's|.*|- [&](https://github.com/&)|' \ | |
| >> "$nvim_readme" | |
| - name: Auto-commit | |
| uses: stefanzweifel/git-auto-commit-action@v5 | |
| with: | |
| commit_message: "bot: auto-update plugin list" |