-
-
Notifications
You must be signed in to change notification settings - Fork 2
38 lines (32 loc) · 1.05 KB
/
jsonBot.yml
File metadata and controls
38 lines (32 loc) · 1.05 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
name: Generate Docs File List
on:
push:
branches:
- master
jobs:
build-file-list:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Generate file list
run: |
echo "Generating docs file list..."
FILES=$(find docs -type f ! -path "docs/static/*" | sed 's/^/"/;s/$/"/' | paste -sd "," -)
echo "Found files: $FILES"
# Insert into package.json
node - <<EOF
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
pkg.files = [${FILES}];
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
EOF
- name: Commit changes
run: |
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
git add package.json
git commit -m "Auto-update docs file list" || echo "No changes to commit"
git push