Skip to content

Commit 9a92327

Browse files
mrjfclaude
andcommitted
feat: add repo-mind index workflow for wiki generation
Copy repo-mind-index.yml workflow and configuration from w3k repo. This workflow will: - Run on push to main and on manual trigger - Generate repo-mind index for the codebase - Generate wiki content using repo-mind - Create PRs with updated indexes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent acfad01 commit 9a92327

File tree

4 files changed

+456
-0
lines changed

4 files changed

+456
-0
lines changed
Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
name: Repo-mind Index
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
actions: write
13+
packages: read
14+
15+
defaults:
16+
run:
17+
shell: bash
18+
19+
jobs:
20+
update-index:
21+
if: github.actor != 'github-actions[bot]'
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Check out repository
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Verify repo-mind access secrets
30+
run: |
31+
set -euo pipefail
32+
if [ -z "${{ secrets.REPO_MIND_GHCR_USERNAME }}" ]; then
33+
echo "Missing required secret REPO_MIND_GHCR_USERNAME" >&2
34+
exit 1
35+
fi
36+
if [ -z "${{ secrets.REPO_MIND_GHCR_TOKEN }}" ]; then
37+
echo "Missing required secret REPO_MIND_GHCR_TOKEN" >&2
38+
exit 1
39+
fi
40+
41+
- name: Seed cache from committed index
42+
run: |
43+
set -euo pipefail
44+
mkdir -p .cache/blobs
45+
if [ -d repo-mind-index ] && [ "$(ls -A repo-mind-index)" ]; then
46+
rsync -a repo-mind-index/ .cache/blobs/
47+
fi
48+
49+
- name: Log in to GHCR
50+
uses: docker/login-action@v3
51+
with:
52+
registry: ghcr.io
53+
username: ${{ secrets.REPO_MIND_GHCR_USERNAME }}
54+
password: ${{ secrets.REPO_MIND_GHCR_TOKEN }}
55+
56+
- name: Pull repo-mind image
57+
run: docker pull ghcr.io/githubnext/repo-mind:latest
58+
59+
- name: Run repo-mind indexer
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.REPO_MIND_GHCR_TOKEN }}
62+
GITHUBNEXT_MODEL_8_UKSOUTH_API_KEY: ${{ secrets.GITHUBNEXT_MODEL_8_UKSOUTH_API_KEY }}
63+
GITHUBNEXT_EASTUS2_API_KEY: ${{ secrets.GITHUBNEXT_EASTUS2_API_KEY }}
64+
run: |
65+
set -euo pipefail
66+
repo_mind_output_file="${PWD}/.repo_mind_output.json"
67+
: > "${repo_mind_output_file}"
68+
chmod 666 "${repo_mind_output_file}"
69+
docker run --rm \
70+
-v "${PWD}":/github/workspace \
71+
-v "${PWD}/repo-mind-config/common.yaml":/opt/repo-mind-action/configs/common.yaml:ro \
72+
-v "${repo_mind_output_file}":/github/workspace/.repo_mind_output.json \
73+
-e REPO_MIND_OP=index \
74+
-e GITHUB_REPOSITORY="${{ github.repository }}" \
75+
-e GITHUB_SHA="${{ github.sha }}" \
76+
-e REPO_MIND_MAX_INDEX_AGE_IN_DAYS=0 \
77+
-e GITHUB_TOKEN \
78+
-e GITHUBNEXT_MODEL_8_UKSOUTH_API_KEY \
79+
-e GITHUBNEXT_EASTUS2_API_KEY \
80+
-e REPO_MIND_OUTPUT_FILE=/github/workspace/.repo_mind_output.json \
81+
ghcr.io/githubnext/repo-mind:latest
82+
83+
rm -f "${repo_mind_output_file}"
84+
85+
- name: Fix blob permissions
86+
run: |
87+
set -euo pipefail
88+
if [ -d .cache/blobs ]; then
89+
sudo chown -R $USER:$USER .cache/blobs || true
90+
chmod -R 755 .cache/blobs || true
91+
fi
92+
93+
- name: Sync generated index into repo
94+
run: |
95+
set -euo pipefail
96+
97+
if [ ! -d ".cache/blobs" ]; then
98+
echo "repo-mind did not produce .cache/blobs" >&2
99+
exit 1
100+
fi
101+
102+
rm -rf repo-mind-index
103+
mkdir -p repo-mind-index
104+
rsync -a --delete .cache/blobs/ repo-mind-index/
105+
106+
- name: Check out repo-mind sources
107+
uses: actions/checkout@v4
108+
with:
109+
repository: githubnext/repo-mind
110+
ref: copilot/refactor-rate-limit-handling
111+
path: repo-mind-src
112+
token: ${{ secrets.REPO_MIND_GHCR_TOKEN }}
113+
persist-credentials: false
114+
115+
- name: Install uv
116+
uses: astral-sh/setup-uv@v4
117+
118+
- name: Prepare repo-mind configuration for wiki
119+
run: |
120+
set -euo pipefail
121+
cp repo-mind-config/wiki-common.yaml repo-mind-src/configs/wiki-common.yaml
122+
cp repo-mind-config/wiki.yaml repo-mind-src/configs/w3k-ci.yaml
123+
124+
- name: Generate repo wiki content
125+
env:
126+
PYTHONPATH: ${{ github.workspace }}/repo-mind-src
127+
REPO_MIND_WORKDIR: ${{ github.workspace }}
128+
GITHUB_TOKEN: ${{ secrets.REPO_MIND_GHCR_TOKEN }}
129+
GITHUBNEXT_MODEL_8_UKSOUTH_API_KEY: ${{ secrets.GITHUBNEXT_MODEL_8_UKSOUTH_API_KEY }}
130+
GITHUBNEXT_EASTUS2_API_KEY: ${{ secrets.GITHUBNEXT_EASTUS2_API_KEY }}
131+
REPO_MIND_LOCAL_CACHE_DIR: ${{ github.workspace }}/.cache/blobs
132+
run: |
133+
set -euo pipefail
134+
uv run --directory repo-mind-src python repo-mind/generate_wiki.py --config-name=w3k-ci
135+
136+
- name: Sync generated wiki into repo
137+
run: |
138+
set -euo pipefail
139+
org=${GITHUB_REPOSITORY%%/*}
140+
repo=${GITHUB_REPOSITORY#*/}
141+
wiki_source="repo-mind-src/.cache/wiki/${org}/${repo}/_edited"
142+
if [ ! -d "${wiki_source}" ]; then
143+
echo "repo-mind wiki output not found at ${wiki_source}" >&2
144+
exit 1
145+
fi
146+
147+
rm -rf repo-wiki
148+
mkdir -p repo-wiki
149+
rsync -a --delete "${wiki_source}/" repo-wiki/
150+
151+
- name: Setup Bun
152+
uses: oven-sh/setup-bun@v2
153+
154+
- name: Generate templated documentation
155+
env:
156+
REPO_MIND_SRC: ${{ github.workspace }}/repo-mind-src
157+
REPO_MIND_WORKDIR: ${{ github.workspace }}
158+
PYTHONPATH: ${{ github.workspace }}/repo-mind-src
159+
GITHUB_TOKEN: ${{ secrets.REPO_MIND_GHCR_TOKEN }}
160+
GITHUBNEXT_MODEL_8_UKSOUTH_API_KEY: ${{ secrets.GITHUBNEXT_MODEL_8_UKSOUTH_API_KEY }}
161+
GITHUBNEXT_EASTUS2_API_KEY: ${{ secrets.GITHUBNEXT_EASTUS2_API_KEY }}
162+
REPO_MIND_LOCAL_CACHE_DIR: ${{ github.workspace }}/.cache/blobs
163+
run: |
164+
set -euo pipefail
165+
if [ -f "scripts/generate-docs.ts" ]; then
166+
echo "Generating documentation from templates..."
167+
bun run scripts/generate-docs.ts
168+
else
169+
echo "No generate-docs.ts script found, skipping template generation"
170+
fi
171+
172+
- name: Prepare git state
173+
run: |
174+
set -euo pipefail
175+
git config user.name "github-actions[bot]"
176+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
177+
178+
- name: Publish wiki
179+
env:
180+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
181+
GITHUB_REPOSITORY: ${{ github.repository }}
182+
GITHUB_ACTOR: github-actions[bot]
183+
run: |
184+
set -euo pipefail
185+
if [ -f "scripts/publish-wiki.ts" ]; then
186+
echo "Publishing wiki content..."
187+
bun run scripts/publish-wiki.ts
188+
else
189+
echo "No publish-wiki.ts script found, skipping wiki publish"
190+
fi
191+
192+
- name: Create pull request with refreshed index
193+
uses: peter-evans/create-pull-request@v6
194+
with:
195+
branch: chore/repo-mind-index-${{ github.run_id }}
196+
title: 'chore: refresh repo-mind index'
197+
commit-message: 'chore: refresh repo-mind index'
198+
body: |
199+
Automated Repo-mind indexing run triggered by `${{ github.sha }}`.
200+
201+
- Workflow: `${{ github.workflow }}`
202+
- Run: `${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`
203+
204+
Please review the generated shards and merge if they look good.
205+
add-paths: |
206+
repo-mind-index/**
207+
repo-wiki/**
208+
docs/repo-wiki/**
209+
delete-branch: true

repo-mind-config/common.yaml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
description: "common config for generic repo"
2+
version: 0.9
3+
4+
input:
5+
default:
6+
path: ${oc.env:REPO_MIND_WORKDIR,/github/workspace}
7+
repo:
8+
slug: ${oc.env:GITHUB_REPOSITORY,githubnext/w3k}
9+
sha: ${oc.env:GITHUB_SHA,null}
10+
code:
11+
include_patterns:
12+
- "**/*.py"
13+
- "**/*.ts"
14+
- "**/*.tsx"
15+
- "**/*.js"
16+
- "**/*.go"
17+
- "**/*.rb"
18+
- "**/*.cpp"
19+
- "**/*.cc"
20+
- "**/*.cxx"
21+
- "**/*.hpp"
22+
- "**/*.h"
23+
- "**/*.hh"
24+
- "**/*.hxx"
25+
exclude_patterns:
26+
- "**/node_modules/**"
27+
- "**/.git/**"
28+
- "**/dist/**"
29+
- "**/build/**"
30+
- "**/__pycache__/**"
31+
- "**/venv/**"
32+
- "**/env/**"
33+
code_docs:
34+
include_patterns:
35+
- "**/*.md"
36+
- "**/*.txt"
37+
- "**/*.rst"
38+
- "**/Dockerfile*"
39+
exclude_patterns:
40+
- "LICENSE"
41+
- "ACKNOWLEDGEMENTS"
42+
- "CONTRIBUTING"
43+
- "CODE_OF_CONDUCT"
44+
- "SECURITY"
45+
- "CHANGELOG"
46+
- "HISTORY"
47+
- "CITATION"
48+
- "MANIFEST.in"
49+
- "**/node_modules/**"
50+
- "**/.git/**"
51+
- "**/dist/**"
52+
- "**/build/**"
53+
- "**/__pycache__/**"
54+
- "**/venv/**"
55+
- "**/env/**"
56+
docs:
57+
issue:
58+
state: closed
59+
allow_bot_origin: false
60+
pr:
61+
state: merged
62+
allow_bot_origin: false
63+
64+
index:
65+
code:
66+
generate_ast: true
67+
generate_code_embeddings: true
68+
generate_code_summary: true
69+
generate_graphrag: true
70+
chunk_size: 8000
71+
chunk_overlap: 200
72+
code_docs:
73+
generate_code_doc_embeddings: true
74+
generate_graphrag: true
75+
chunk_size: 1000
76+
chunk_overlap: 100
77+
docs:
78+
generate_doc_issue_embeddings: true
79+
generate_doc_pr_embeddings: true
80+
generate_graphrag: true
81+
chunk_size: 1000
82+
chunk_overlap: 100
83+
graphrag:
84+
generate_summaries_at_index: false
85+
max_cluster_size: 10
86+
knn_doc_to_graph: 5
87+
88+
processing:
89+
generate_model_id: "next-gpt-4.1-long-context"
90+
summarization_model_id: "next-gpt-4.1"
91+
embedding_model_id: "next-text-embedding-3-small-2"
92+
parallelism: 32
93+
update_if_exists: true
94+
use_content_filter: true
95+
96+
storage:
97+
kind: azure
98+
namespace: "v0.2.0/dev"
99+
100+
query:
101+
generate_answer: true
102+
top_k: 20
103+
use_code: true
104+
use_code_summary: true
105+
use_code_doc: true
106+
use_doc: true
107+
use_graphrag: true
108+
structured_response_format: true
109+
rewrite_query_flag: true
110+
111+
debug:
112+
print_every: 50
113+
usage_tracking: false
114+
disable_index_storage: false
115+
force_from_scratch_indexing: false
116+
117+
evaluation:
118+
evaluation_model_id: "next-o3"
119+
120+
defaults:
121+
- query_graphrag_zero

0 commit comments

Comments
 (0)