-
Notifications
You must be signed in to change notification settings - Fork 1
43 lines (34 loc) · 1.42 KB
/
update-plugin-list.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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@v5
with:
commit_message: "bot: auto-update plugin list"