Skip to content

Commit 3f4710d

Browse files
Create jsonBot.yml
1 parent 719595f commit 3f4710d

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

.github/workflows/jsonBot.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Generate Docs File List
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build-file-list:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v3
15+
16+
- name: Generate file list
17+
run: |
18+
echo "Generating docs file list..."
19+
FILES=$(find docs -type f ! -path "docs/static/*" | sed 's/^/"/;s/$/"/' | paste -sd "," -)
20+
echo "Found files: $FILES"
21+
22+
# Insert into package.json
23+
node - <<EOF
24+
const fs = require('fs');
25+
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
26+
pkg.files = [${FILES}];
27+
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
28+
EOF
29+
30+
- name: Commit changes
31+
run: |
32+
git config --global user.name "github-actions"
33+
git config --global user.email "github-actions@github.com"
34+
git add package.json
35+
git commit -m "Auto-update docs file list" || echo "No changes to commit"
36+
git push

0 commit comments

Comments
 (0)