Skip to content

Commit 1837ef3

Browse files
committed
Create repomix.yml
1 parent 788528a commit 1837ef3

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed

.github/workflows/repomix.yml

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Repository Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch: # allows manual triggering
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
analyze:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0 # fetch all history for better context
22+
23+
- name: Wait for other checks
24+
run: |
25+
echo "Waiting for 5 minutes to allow other checks to complete..."
26+
sleep 300
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: "20"
32+
33+
- name: Install Repomix
34+
run: npm install -g repomix
35+
36+
- name: Generate Repository Documentation
37+
run: |
38+
echo "Creating DOCS directory..."
39+
mkdir -p DOCS
40+
41+
echo "Running Repomix..."
42+
if ! repomix --output DOCS/repository_context.txt --style markdown --remove-empty-lines --verbose; then
43+
echo "Error: Repomix command failed"
44+
# Print directory contents for debugging
45+
echo "DOCS directory contents:"
46+
ls -la DOCS/
47+
exit 1
48+
fi
49+
50+
echo "Verifying output file..."
51+
if [ ! -f "DOCS/repository_context.txt" ]; then
52+
echo "Error: repository_context.txt was not created"
53+
# Print directory contents for debugging
54+
echo "DOCS directory contents:"
55+
ls -la DOCS/
56+
exit 1
57+
fi
58+
59+
if [ ! -s "DOCS/repository_context.txt" ]; then
60+
echo "Error: repository_context.txt is empty"
61+
exit 1
62+
fi
63+
64+
echo "Repository context file generated successfully"
65+
echo "File size: $(stat --format=%s "DOCS/repository_context.txt") bytes"
66+
echo "First few lines of the file:"
67+
head -n 5 "DOCS/repository_context.txt"
68+
69+
# Update Documentation
70+
- name: Commit and Push Changes
71+
run: |
72+
echo "Configuring git..."
73+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
74+
git config --local user.name "github-actions[bot]"
75+
76+
echo "Checking for changes..."
77+
if [[ -n "$(git status --porcelain)" ]]; then
78+
echo "Changes detected, committing..."
79+
80+
# Stage only repository_context.txt to avoid unintended changes
81+
if ! git add DOCS/repository_context.txt; then
82+
echo "Error: Failed to stage repository_context.txt"
83+
exit 1
84+
fi
85+
86+
if ! git commit -m "docs: update repository context via Repomix [skip ci]"; then
87+
echo "Error: Failed to create commit"
88+
exit 1
89+
fi
90+
91+
echo "Pushing to main branch..."
92+
if ! git push; then
93+
echo "Error: Failed to push changes"
94+
exit 1
95+
fi
96+
97+
echo "Successfully updated repository context"
98+
else
99+
echo "No changes detected in repository_context.txt"
100+
fi

0 commit comments

Comments
 (0)