Skip to content

Commit d2dc0b7

Browse files
committed
stub out some json diffing
1 parent 0ad5b31 commit d2dc0b7

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

.github/workflows/new-plugin.yml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,47 @@ jobs:
2525

2626
- name: Get plugins info
2727
run: |
28-
OLD="$(
28+
OLD_PLUGINS=$(
2929
nix eval 'github:${{ github.repository }}/${{ github.event.before }}#nixvimConfiguration.options.plugins' \
3030
--apply 'builtins.attrNames' \
3131
--json
32-
)"
33-
NEW="$(
32+
)
33+
NEW_PLUGINS=$(
3434
nix eval '.#nixvimConfiguration.options.plugins' \
3535
--apply 'builtins.attrNames' \
3636
--json
37-
)"
38-
# TODO: compare OLD and NEW
37+
)
38+
OLD_COLORSCHEMES=$(
39+
nix eval 'github:${{ github.repository }}/${{ github.event.before }}#nixvimConfiguration.options.colorschemes' \
40+
--apply 'builtins.attrNames' \
41+
--json
42+
)
43+
NEW_COLORSCHEMES=$(
44+
nix eval '.#nixvimConfiguration.options.colorschemes' \
45+
--apply 'builtins.attrNames' \
46+
--json
47+
)
48+
PLUGIN_JSON="{ \"old\": $OLD_PLUGINS, \"new\": $NEW_PLUGINS }"
49+
COLORSCHEME_JSON="{ \"old\": $OLD_COLORSCHEMES, \"new\": $NEW_COLORSCHEMES }"
50+
51+
# Compare OLD and NEW
52+
PLUGINS_ADDED=$(echo "$PLUGIN_JSON" | jq '.new-.old')
53+
PLUGINS_REMOVED=$(echo "$PLUGIN_JSON" | jq '.old-.new')
54+
COLORSCHEMES_ADDED=$(echo "$COLORSCHEME_JSON" | jq '.new-.old')
55+
COLORSCHEMES_REMOVED=$(echo "$COLORSCHEME_JSON" | jq '.old-.new')
56+
57+
# TODO: write to GITHUB_OUTPUT
3958
4059
- name: Get PR info
4160
env:
4261
GH_TOKEN: ${{ github.token }}
4362
run: |
44-
if JSON="$(
63+
if JSON=$(
4564
gh api \
4665
-H "Accept: application/vnd.github+json" \
4766
-H "X-GitHub-Api-Version: 2022-11-28" \
4867
/repos/${{ github.repository }}/commits/${{ github.sha }}/pulls
49-
)"
68+
)
5069
then
5170
# TODO: use PR info
5271
else

0 commit comments

Comments
 (0)