File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments