Skip to content

feat: add GitHub Action to auto-update project_structure.txt#496

Merged
M4dhav merged 15 commits intoAOSSIE-Org:devfrom
yuvikaaaaaa:github-action-project-structure
Aug 1, 2025
Merged

feat: add GitHub Action to auto-update project_structure.txt#496
M4dhav merged 15 commits intoAOSSIE-Org:devfrom
yuvikaaaaaa:github-action-project-structure

Conversation

@yuvikaaaaaa
Copy link
Contributor

@yuvikaaaaaa yuvikaaaaaa commented Jul 28, 2025

Description

This PR adds a GitHub Action workflow that automatically generates a project_structure.txt file whenever a new push is made. This helps contributors and maintainers quickly view the structure of the repository.

Fixes #475

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Tested by committing and pushing the workflow to a new branch. Verified that the GitHub Action runs successfully and creates project_structure.txt in the root of the repo.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation (if needed)
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes (if applicable)

Summary by CodeRabbit

Summary by CodeRabbit

  • Chores
    • Added an automated workflow to keep the project structure file up to date on specific branches.
    • Documented the comprehensive project directory structure for improved organization and clarity.

Vikas Naik and others added 3 commits May 29, 2025 15:13
- Move greet_contributors.yml from .github/WORK_FLOW/ to .github/workflows/
- GitHub Actions requires workflows to be in .github/workflows/ directory
- This fixes the workflow not triggering on issues/PRs
- Added permissions, error handling, and logging improvements

Fixes AOSSIE-Org#462
…-workflow-path

fix: resolve greet contributors workflow by moving to correct directory and adding reliability improvements
@coderabbitai
Copy link

coderabbitai bot commented Jul 28, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

A new GitHub Actions workflow is added to automatically generate and update a project_structure.txt file on every push to the github-action-project-structure branch. The workflow checks out the code, creates the directory tree while excluding specified files and folders, and commits any changes to the file back to the repository.

Changes

Cohort / File(s) Change Summary
GitHub Actions Workflow
.github/workflows/update-project-structure.yml
Adds a workflow triggered on pushes to github-action-project-structure and dev branches that generates and commits an updated project_structure.txt file by running the tree command excluding node_modules and .git.
Project Structure File
project_structure.txt
Adds a comprehensive project directory structure listing for a multi-platform Flutter application, detailing configuration, source code, assets, documentation, and platform-specific files.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Assessment against linked issues

Objective Addressed Explanation
Add a GitHub Action that automatically updates project_structure.txt whenever a PR is merged into main (#475) The workflow updates on pushes to github-action-project-structure and dev branches, not explicitly on PR merges to main as requested.
Use the tree command to generate project_structure.txt The workflow runs the tree command excluding node_modules and .git to generate the file.
Commit and push the updated project_structure.txt automatically The workflow commits and pushes changes back to the branch using the GitHub Actions bot identity.

Poem

In the warren of code, a new path appears,
With each push to branch, the structure is clear.
A bunny with scripts, so clever and spry,
Maps out the folders, no need to ask why.
Hop, commit, and push—our project’s in view,
Thanks to this workflow, neatness shines through! 🐇✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/workflows/update-project-structure.yml (1)

13-13: Update checkout action to v4 (v3 flagged as outdated).
actions/checkout@v3 is already in maintenance-only mode and the latest runners ship with v4. Upgrading avoids deprecation surprises and gets you the improved default auth handling.

-        uses: actions/checkout@v3
+        uses: actions/checkout@v4
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 153a4dc and 5785984.

📒 Files selected for processing (1)
  • .github/workflows/update-project-structure.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/update-project-structure.yml

13-13: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

Comment on lines +15 to +17
- name: Generate project_structure.txt
run: |
tree -a -I 'node_modules|.git|build|.dart_tool|*.lock|*.pyc' > project_structure.txt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

tree is not pre-installed on ubuntu-latest; the step will fail.
GitHub-hosted runners do not include tree by default, so this command exits with 127. Install it first or switch to a pure-Git solution (git ls-files). Example fix:

+      - name: Install dependencies
+        run: sudo apt-get update && sudo apt-get install -y tree
+
       - name: Generate project_structure.txt
         run: |
           tree -a -I 'node_modules|.git|build|.dart_tool|*.lock|*.pyc' > project_structure.txt
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Generate project_structure.txt
run: |
tree -a -I 'node_modules|.git|build|.dart_tool|*.lock|*.pyc' > project_structure.txt
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y tree
- name: Generate project_structure.txt
run: |
tree -a -I 'node_modules|.git|build|.dart_tool|*.lock|*.pyc' > project_structure.txt
🤖 Prompt for AI Agents
In .github/workflows/update-project-structure.yml at lines 15 to 17, the
workflow uses the `tree` command which is not pre-installed on the
`ubuntu-latest` runner, causing the step to fail. Fix this by adding a step
before this to install `tree` using `sudo apt-get update && sudo apt-get install
-y tree`, or replace the `tree` command with a pure Git alternative like `git
ls-files` to generate the project structure without external dependencies.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
.github/workflows/update-project-structure.yml (2)

15-17: tree package still not installed – step will exit 127
GitHub-hosted runners don’t include tree; the previous review already raised this. Add an install step or switch to a pure-Git solution.

+      - name: Install dependencies
+        run: |
+          sudo apt-get update
+          sudo apt-get install -y tree
+
       - name: Generate project structure
         run: |
           tree -a -I 'node_modules|.git' > project_structure.txt

8-10: Skip job when the actor is the bot to prevent infinite commit loop
Every push generated by this workflow re-triggers itself. Guard the job with an if: condition.

 jobs:
   generate-structure:
+    if: github.actor != 'github-actions[bot]'
     runs-on: ubuntu-latest
🧹 Nitpick comments (2)
.github/workflows/update-project-structure.yml (2)

19-25: Make the commit step idempotent to avoid failures when nothing changes
git commit exits 1 when there are no diffs, causing the job to fail. Short-circuit the commit or use --allow-empty.

       - name: Commit and push changes
         run: |
           git config user.name "github-actions[bot]"
           git config user.email "github-actions[bot]@users.noreply.github.com"
           git add project_structure.txt
-          git commit -m "chore: update project structure"
+          git diff --cached --quiet || git commit -m "chore: update project structure"
           git push

25-25: Add a trailing newline to satisfy YAML-lint
Minor style nit—prevents the new-line-at-end-of-file warning.

-          git push⏎
+          git push
+
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5785984 and 461766e.

📒 Files selected for processing (1)
  • .github/workflows/update-project-structure.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/update-project-structure.yml

13-13: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 YAMLlint (1.37.1)
.github/workflows/update-project-structure.yml

[error] 25-25: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (1)
.github/workflows/update-project-structure.yml (1)

3-7: Verify default branch name
The trigger targets master, but many repos (including new GitHub defaults) use main. Ensure this matches Resonate’s default branch to avoid the workflow never running.

@M4dhav M4dhav linked an issue Jul 31, 2025 that may be closed by this pull request
Copy link
Contributor

@M4dhav M4dhav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make these changes and change the base of the PR from master to dev

@M4dhav M4dhav added the documentation Improvements or additions to documentation label Jul 31, 2025
@yuvikaaaaaa yuvikaaaaaa changed the base branch from master to dev July 31, 2025 21:48
@yuvikaaaaaa
Copy link
Contributor Author

@M4dhav I've made all the requested changes. Let me know if anything else is needed!

@M4dhav
Copy link
Contributor

M4dhav commented Jul 31, 2025

Also resolve the conflict with base branch

@yuvikaaaaaa
Copy link
Contributor Author

@M4dhav Please have a look now!

@M4dhav
Copy link
Contributor

M4dhav commented Aug 1, 2025

Great Work! Thank you for your contribution!

@M4dhav M4dhav merged commit eaaa4ce into AOSSIE-Org:dev Aug 1, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add GitHub Action to auto-update project_structure.txt

4 participants