Repository navigation
126 lines (113 loc) · 4.47 KB
/
Copy pathsoop-encode.yml
File metadata and controls
126 lines (113 loc) · 4.47 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Soop Encode
on:
workflow_dispatch:
inputs:
force_encode:
description: 'Force full re-encode, ignoring existing .soop/graph.json (use when graph is stale or corrupted)'
type: boolean
default: false
push:
branches: [main]
paths:
- '**/*.ts'
- '**/*.js'
- '**/*.py'
- '**/*.rs'
- '**/*.go'
- '**/*.java'
- '!vendor/**'
- '!**/node_modules/**'
- '!**/dist/**'
- '!**/build/**'
- '!.soop/graph.json'
- '!.soop/graph.meta.json'
- '!.soop/embeddings.json'
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
permissions:
contents: write
pull-requests: write
jobs:
encode:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/create-github-app-token@v3
id: app-token
with:
client-id: ${{ secrets.CLIENT_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
- uses: oven-sh/setup-bun@ecf28ddc73e819eb6fa29df6b34ef8921c743461 # v2
with:
bun-version: latest
- name: Install Repo Please
run: bun install -g @pleaseai/soop@latest
- name: Restore semantic cache
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: .soop/cache/semantic-cache.db*
key: semantic-cache-${{ github.sha }}
restore-keys: semantic-cache-
# tree-sitter grammars (native NAPI) download on demand and persist in the
# cache dir pinned via SOOP_TS_CACHE_DIR. Caching it makes encode/evolve
# deterministic and avoids re-downloading grammars on every run.
- name: Restore tree-sitter parser cache
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: .soop/cache/tree-sitter
key: tree-sitter-pack-${{ github.sha }}
restore-keys: tree-sitter-pack-
- name: Encode or evolve RPG
env:
GOOGLE_GENERATIVE_AI_API_KEY: ${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }}
FORCE_ENCODE: ${{ github.event.inputs.force_encode || 'false' }}
SOOP_TS_CACHE_DIR: ${{ github.workspace }}/.soop/cache/tree-sitter
run: |
if [ "$FORCE_ENCODE" = "true" ]; then
echo "force_encode=true — removing existing graph and running full encode"
rm -f .soop/graph.json .soop/graph.meta.json .soop/embeddings.json
mkdir -p .soop
soop encode . -o .soop/graph.json -m google/gemini-3.1-flash-lite-preview
elif [ ! -f ".soop/graph.json" ]; then
echo "No existing graph — running full encode"
mkdir -p .soop
soop encode . -o .soop/graph.json -m google/gemini-3.1-flash-lite-preview
else
LAST_COMMIT=$(soop last-commit .soop/graph.json 2>/dev/null || echo "")
if [ -z "$LAST_COMMIT" ]; then
echo "No commit stamp — running full encode"
soop encode . -o .soop/graph.json -m google/gemini-3.1-flash-lite-preview
else
echo "Evolving from $LAST_COMMIT..HEAD"
soop evolve . -l .soop/graph.json -c "$LAST_COMMIT..HEAD" -m google/gemini-3.1-flash-lite-preview || {
echo "Evolve failed, falling back to full encode"
soop encode . -o .soop/graph.json -m google/gemini-3.1-flash-lite-preview
}
fi
fi
- name: Save semantic cache
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
if: always()
with:
path: .soop/cache/semantic-cache.db*
key: semantic-cache-${{ github.sha }}
- name: Save tree-sitter parser cache
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
if: always()
with:
path: .soop/cache/tree-sitter
key: tree-sitter-pack-${{ github.sha }}
- name: Create PR with updated graph
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
token: ${{ steps.app-token.outputs.token }}
commit-message: 'chore(soop): update graph'
title: 'chore(soop): update graph'
body: Auto-generated by Repo Encode workflow.
branch: chore/soop-update-graph
add-paths: .soop/