Modernize GitHub Action to auto-generate DIRECTORY.md (#6308) #1
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: Generate Directory Markdown | |
on: | |
push: | |
branches: [master] | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
generate-directory: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Run Directory Tree Generator | |
uses: DenizAltunkapan/directory-tree-generator@v2 | |
with: | |
path: src | |
extensions: .java | |
show-extensions: false | |
- name: Commit and Push DIRECTORY.md | |
run: | | |
cat DIRECTORY.md | |
git config --global user.name "$GITHUB_ACTOR" | |
git config --global user.email "[email protected]" | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY | |
git add DIRECTORY.md | |
git commit -am "Update directory" || true | |
git push origin HEAD:$GITHUB_REF |