Skip to content

Commit 5ae0050

Browse files
committed
structure
1 parent 63da0ce commit 5ae0050

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Update README with File Structure
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
update-readme:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v2
17+
18+
- name: Update README.md
19+
uses: actions/github-script@v6
20+
with:
21+
script: |
22+
const { execSync } = require('child_process');
23+
const fs = require('fs');
24+
25+
const fileStructure = execSync('tree -L 2').toString();
26+
27+
const readmePath = 'README.md';
28+
let readmeContent = fs.readFileSync(readmePath, 'utf8');
29+
readmeContent = readmeContent.replace(/## File Structure.*?(?=## |$)/s, `## File Structure\n${fileStructure}`);
30+
fs.writeFileSync(readmePath, readmeContent);
31+
32+
- uses: EndBug/add-and-commit@v9
33+
with:
34+
default_author: github_actions

0 commit comments

Comments
 (0)