This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |