Skip to content

Commit 7eccdda

Browse files
authored
feat(data): give data change info (#256)
1 parent bf3e93f commit 7eccdda

File tree

13 files changed

+572
-380
lines changed

13 files changed

+572
-380
lines changed

.github/workflows/collect.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
workflow_dispatch:
66
concurrency:
77
group: ${{ github.ref }}-${{ github.workflow }}
8-
cancel-in-progress: true
8+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
99
jobs:
1010
pipeline:
1111
name: Pipeline
@@ -35,9 +35,19 @@ jobs:
3535
. venv/bin/activate
3636
python3 -m pip install -r requirements.txt
3737
python3 collect.py
38+
COLLECT_BEFORE="$(cat collect-before.log)"
39+
COLLECT_AFTER="$(cat collect-after.log)"
40+
COLLECT_CHANGE=`expr $COLLECT_AFTER - $COLLECT_BEFORE`
41+
if [[ "$COLLECT_CHANGE" != -* ]]; then
42+
COLLECT_CHANGE="+$COLLECT_CHANGE"
43+
fi
44+
echo "COLLECT_BEFORE:$COLLECT_BEFORE, COLLECT_AFTER:$COLLECT_AFTER, COLLECT_CHANGE:$COLLECT_CHANGE"
45+
echo "COLLECT_BEFORE=$COLLECT_BEFORE" >> "$GITHUB_ENV"
46+
echo "COLLECT_AFTER=$COLLECT_AFTER" >> "$GITHUB_ENV"
47+
echo "COLLECT_CHANGE=$COLLECT_CHANGE" >> "$GITHUB_ENV"
3848
- name: Auto Commit
39-
uses: stefanzweifel/git-auto-commit-action@v4
49+
uses: stefanzweifel/git-auto-commit-action@v5
4050
with:
41-
commit_message: "chore(colors): auto update colorschemes list"
51+
commit_message: "chore(colors): auto update colorschemes ${{ env.COLLECT_CHANGE }}"
4252
push_options: "--force"
4353
skip_dirty_check: true

COLORSCHEMES.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11

2-
ColorSchemes List (56)
2+
ColorSchemes List (60)
33
======================
44

5+
- [morhetz/gruvbox](https://github.com/morhetz/gruvbox) (stars: 14237, last update: 2023-08-14)
6+
- gruvbox
57
- [folke/tokyonight.nvim](https://github.com/folke/tokyonight.nvim) (stars: 6800, last update: 2025-02-18)
68
- tokyonight
79
- tokyonight-day
@@ -21,6 +23,8 @@ ColorSchemes List (56)
2123
- kanagawa-wave
2224
- [joshdick/onedark.vim](https://github.com/joshdick/onedark.vim) (stars: 3927, last update: 2024-07-16)
2325
- onedark
26+
- [tomasr/molokai](https://github.com/tomasr/molokai) (stars: 3617, last update: 2015-11-11)
27+
- molokai
2428
- [edeneast/nightfox.nvim](https://github.com/edeneast/nightfox.nvim) (stars: 3400, last update: 2025-02-09)
2529
- carbonfox
2630
- dawnfox
@@ -58,6 +62,8 @@ ColorSchemes List (56)
5862
- gruvbox
5963
- [rakr/vim-one](https://github.com/rakr/vim-one) (stars: 2008, last update: 2020-12-14)
6064
- one
65+
- [nanotech/jellybeans.vim](https://github.com/nanotech/jellybeans.vim) (stars: 1821, last update: 2019-06-21)
66+
- jellybeans
6167
- [sainnhe/sonokai](https://github.com/sainnhe/sonokai) (stars: 1800, last update: 2025-02-24)
6268
- sonokai
6369
- [ayu-theme/ayu-vim](https://github.com/ayu-theme/ayu-vim) (stars: 1732, last update: 2024-07-15)
@@ -67,6 +73,8 @@ ColorSchemes List (56)
6773
- [junegunn/seoul256.vim](https://github.com/junegunn/seoul256.vim) (stars: 1674, last update: 2023-05-03)
6874
- seoul256
6975
- seoul256-light
76+
- [w0ng/vim-hybrid](https://github.com/w0ng/vim-hybrid) (stars: 1486, last update: 2016-01-05)
77+
- hybrid
7078
- [ku1ik/vim-monokai](https://github.com/ku1ik/vim-monokai) (stars: 1451, last update: 2022-02-09)
7179
- monokai
7280
- [dracula/vim](https://github.com/dracula/vim) (stars: 1400, last update: 2024-07-21)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ It uses GitHub actions to weekly collect/update the colorscheme dataset.
3939
> With below conditions:
4040
>
4141
> 1. GitHub stars ≥ 500 (by default it only enable ≥ 800, see [Configuration](#-configuration)).
42-
> 2. Last git commit is in last 5 years.
42+
> 2. Last git commit is in last 10 years.
4343
> 3. For multiple plugins that contain a same color name, it picks by following rules:
4444
> 1. The _**awesome-neovim**_ wins the _**vimcolorschemes**_ (they usually support modern Neovim features).
4545
> 2. More github stars.

collect-after.log

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
60

collect-before.log

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
56

collect.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
# github
2525
GITHUB_STARS = 500
26-
LAST_GIT_COMMIT = 5 * 365 * 24 * 3600 # 5 years * 365 days * 24 hours * 3600 seconds
26+
LAST_GIT_COMMIT = 10 * 365 * 24 * 3600 # 10 years * 365 days * 24 hours * 3600 seconds
2727
BLACKLIST = [
2828
"rafi/awesome-vim-colorschemes",
2929
"mini.nvim#minischeme",
@@ -390,7 +390,7 @@ def _parse_spec(
390390
a_elem = element.find_element(
391391
By.XPATH, "./a[starts-with(@class,'repositoryCard')]"
392392
)
393-
url = a_elem.get_attribute("href")
393+
url: str = a_elem.get_attribute("href") # type: ignore
394394
if url.endswith("/"):
395395
url = url[:-1]
396396
logging.debug(f"parsing (vsc) spec handle_elem:{url}")
@@ -734,13 +734,23 @@ def build(self) -> None:
734734
@click.option("--skip-fetch", "skip_fetch_opt", is_flag=True, help="skip fetch")
735735
@click.option("--skip-clone", "skip_clone_opt", is_flag=True, help="skip clone")
736736
def collect(debug_opt, no_headless_opt, skip_fetch_opt, skip_clone_opt):
737+
# Initialize
737738
global WEBDRIVER_HEADLESS
738739
init_logging(logging.DEBUG if debug_opt else logging.INFO)
739740
logging.debug(
740741
f"debug_opt:{debug_opt}, no_headless_opt:{no_headless_opt}, skip_fetch_opt:{skip_fetch_opt}, skip_clone_opt:{skip_clone_opt}"
741742
)
742743
if no_headless_opt:
743744
WEBDRIVER_HEADLESS = False
745+
746+
# Before updating data
747+
DB = TinyDB("db.json")
748+
before = len(DB.all())
749+
logging.info(f"Before updating, DB count:{before}")
750+
with open("collect-before.log", "w") as result:
751+
result.write(f"{before}")
752+
753+
# Collect data
744754
if not skip_fetch_opt:
745755
ColorSpec.truncate()
746756
vcs = VimColorSchemes()
@@ -753,9 +763,17 @@ def collect(debug_opt, no_headless_opt, skip_fetch_opt, skip_clone_opt):
753763
clean_old_clones = False
754764
if skip_clone_opt:
755765
clean_old_clones = False
766+
767+
# Build new data source
756768
builder = Builder(clean_old_clones)
757769
builder.build()
758770

771+
# After updating data
772+
after = len(DB.all())
773+
logging.info(f"After updating, DB count:{after}")
774+
with open("collect-after.log", "w") as result:
775+
result.write(f"{after}")
776+
759777

760778
if __name__ == "__main__":
761779
collect()

0 commit comments

Comments
 (0)