Skip to content

DenizAltunkapan/directory-tree-generator

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📁 Directory Tree Generator

GitHub Action

A GitHub Action that automatically generates a Markdown file (DIRECTORY.md) representing the folder structure of your project as a clickable tree view.

Perfect for documentation, open source projects, and maintaining clean, readable repositories.


✨ Features

  • 🔍 Recursively scans any specified directory (or multiple, comma-separated directories)
  • 🔗 Generates a Markdown-based tree with clickable relative links
  • 🔧 Filters files by extension (e.g. .ts, .js)
  • 🎛️ Optionally hides or shows file extensions (--show-extensions)
  • 📁 Outputs a DIRECTORY.md file at the project root

🚀 Usage as a GitHub Action

1. Add a workflow file to your target repository

# .github/workflows/generate-directory.yml
name: Generate Directory Markdown

on:
  push:
    branches: [main]
  workflow_dispatch:

jobs:
  generate-directory:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Run Directory Tree Generator
        uses: DenizAltunkapan/[email protected]
        with:
          path: frontend,backend
          extensions: .ts,.js
          show-extensions: false

⚙️ Input Parameters

Parameter Description Default
path Relative path or multiple comma-separated paths of the directories to scan .
extensions Comma-separated list of file extensions (e.g. .ts,.js). Use . to include all files .
show-extensions true → keep extensions (e.g. Main.java), false → hide them (e.g. Main) false

📄 Example Output

With show-extensions: false:

  • 📁 frontend

  • 📁 backend


🛠 Local Usage (Optional)

You can also use this tool locally in any Node.js environment:

npm install
npm run build

# Example 1: Show extensions
node dist/index.js --path frontend,backend --extensions .ts,.js --show-extensions true

# Example 2: Hide extensions
node dist/index.js --path src --extensions .ts --show-extensions false

The output DIRECTORY.md will be created in the project root.


🙌 Contributing

Pull requests are welcome! Feel free to open issues for bugs, enhancements, or feature requests.

About

Generate a clean, markdown-based directory tree in DIRECTORY.md from any project's folder structure.

Resources

License

Stars

Watchers

Forks

Packages

No packages published