Skip to content

Commit

Permalink
structure
Browse files Browse the repository at this point in the history
  • Loading branch information
ProFastCode committed Jul 24, 2024
1 parent 63da0ce commit 5ae0050
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/structure-to-readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Update README with File Structure

on:
push:
branches:
- main

permissions:
contents: write

jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Update README.md
uses: actions/github-script@v6
with:
script: |
const { execSync } = require('child_process');
const fs = require('fs');
const fileStructure = execSync('tree -L 2').toString();
const readmePath = 'README.md';
let readmeContent = fs.readFileSync(readmePath, 'utf8');
readmeContent = readmeContent.replace(/## File Structure.*?(?=## |$)/s, `## File Structure\n${fileStructure}`);
fs.writeFileSync(readmePath, readmeContent);
- uses: EndBug/add-and-commit@v9
with:
default_author: github_actions

0 comments on commit 5ae0050

Please sign in to comment.