-
-
Notifications
You must be signed in to change notification settings - Fork 2
74 lines (65 loc) · 2.31 KB
/
write-readmes.yml
File metadata and controls
74 lines (65 loc) · 2.31 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
name: Fetch and Create READMEs
concurrency:
group: write-readmes
cancel-in-progress: true
on:
workflow_dispatch:
permissions:
contents: write
jobs:
fetch-and-create:
runs-on: ubuntu-latest
name: Fetch and Create READMEs
steps:
- name: Install Git LFS
run: |
sudo apt-get update
sudo apt-get install -y git-lfs
git lfs install
- name: Checkout code
uses: actions/checkout@v6
with:
lfs: true
- uses: oven-sh/setup-bun@v2
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24.x
- name: Install dependencies
run: bun install
- name: Create READMEs
run: node scripts/write_readme.mjs
env:
BEARER_TOKEN: ${{ secrets.BEARER_TOKEN }}
- name: Check for changes
id: git-check
run: |
if git diff --quiet && git diff --cached --quiet; then
echo "changes=false" >> $GITHUB_OUTPUT
else
echo "changes=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push generated files
if: steps.git-check.outputs.changes == 'true'
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git lfs track "loadedVectorStore/*.json" 2>/dev/null || true
git lfs track "loadedVectorStore/*.index" 2>/dev/null || true
git add .gitattributes 2>/dev/null || true
git add loadedVectorStore/*.json loadedVectorStore/*.index 2>/dev/null || true
git add -A
git commit -m "chore: update READMEs from NPM packages [skip ci]" \
-m "Automated update from write-readmes workflow" \
-m "Run ID: ${{ github.run_id }}"
# Try to pull and rebase in case of conflicts
git pull --rebase origin main || {
echo "⚠️ Rebase conflict detected, aborting and retrying..."
git rebase --abort
git pull --no-rebase origin main
exit 1
}
git push origin main
- name: Report no changes
if: steps.git-check.outputs.changes != 'true'
run: echo "✅ No changes to commit - READMEs are up to date"