Merge pull request #4 from aSel1x/main #4
This file contains 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: Get tree and commit to readme | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
update-readme: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Get tree and update README.md | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const { execSync } = require('child_process'); | |
const fs = require('fs'); | |
const fileStructure = execSync('cd app && tree').toString(); | |
const readmePath = 'README.md'; | |
let readmeContent = fs.readFileSync(readmePath, 'utf8'); | |
readmeContent = readmeContent.replace(/## File Structure.*?(?=## |$)/s, '## File Structure\n```\n' + fileStructure + '```\n\n'); | |
fs.writeFileSync(readmePath, readmeContent); | |
- uses: EndBug/add-and-commit@v9 | |
with: | |
default_author: github_actions |