Skip to content

Commit

Permalink
Merge pull request #275 from yashksaini-coder/yash/fix-162
Browse files Browse the repository at this point in the history
Add Contributors and Project structure markdown workflows
  • Loading branch information
PriyaGhosal authored Oct 8, 2024
2 parents 1a78492 + a838fb2 commit 41ac141
Show file tree
Hide file tree
Showing 5 changed files with 246 additions and 21 deletions.
67 changes: 67 additions & 0 deletions .github/scripts/update_structure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import os
import github
from github import Github

def get_repo_structure(path='.', prefix=''):
structure = []
items = sorted(os.listdir(path))
for i, item in enumerate(items):
if item.startswith('.'):
continue
item_path = os.path.join(path, item)
is_last = i == len(items) - 1
current_prefix = '└── ' if is_last else '├── '
structure.append(f"{prefix}{current_prefix}{item}")
if os.path.isdir(item_path):
next_prefix = prefix + (' ' if is_last else '│ ')
structure.extend(get_repo_structure(item_path, next_prefix))
return structure

def update_structure_file(structure):
with open('project_structure.txt', 'w') as f:
f.write('\n'.join(structure))

def update_readme(structure):
with open('project-structure.md', 'r') as f: # updated file name
content = f.read()

start_marker = '<!-- START_STRUCTURE -->'
end_marker = '<!-- END_STRUCTURE -->'

start_index = content.find(start_marker)
end_index = content.find(end_marker)

if start_index != -1 and end_index != -1:
new_content = (
content[:start_index + len(start_marker)] +
'\n```\n' + '\n'.join(structure) + '\n```\n' +
content[end_index:]
)

with open('project-structure.md', 'w') as f:
f.write(new_content)
print("Repo-structure.md updated with new structure.")
else:
print("Markers not found in Repo-structure.md. Structure not updated.")

def main():
g = Github(os.environ['GH_TOKEN'])
repo = g.get_repo(os.environ['GITHUB_REPOSITORY'])

current_structure = get_repo_structure()

try:
contents = repo.get_contents("project_structure.txt")
existing_structure = contents.decoded_content.decode().split('\n')
except github.GithubException:
existing_structure = None

if current_structure != existing_structure:
update_structure_file(current_structure)
update_readme(current_structure)
print("Repository structure updated.")
else:
print("No changes in repository structure.")

if __name__ == "__main__":
main()
25 changes: 25 additions & 0 deletions .github/workflows/add-contributor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Update Contributors in README
on:
push:
branches: ["main"]
workflow_dispatch:

jobs:
contrib-readme-job:
runs-on: ubuntu-latest
name: An action workflow to automate contributors in README
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Update Contributors List
uses: akhilmhdh/contributors-readme-action@v2.3.10
with:
commit_message: "Updated contributors list"
committer_username: "yashksaini-coder"
committer_email: "115717039+yashksaini-coder@users.noreply.github.com"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38 changes: 38 additions & 0 deletions .github/workflows/update-structure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Detect and Update Repo Structure

on:
schedule:
- cron: '0 * * * *' # Run every hour
workflow_dispatch: # Allow manual triggering
push:
branches:
- main

jobs:
detect-and-update-structure:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.12

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install PyGithub
- name: Run update script
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python .github/scripts/update_structure.py

- name: Commit and push if changed
run: |
git config --local user.email ""115717039+yashksaini-coder@users.noreply.github.com""
git config --local user.name "yashksaini-coder"
git add .
git diff --quiet && git diff --staged --quiet || (git commit -m "Update repo structure" && git push)
101 changes: 80 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,49 @@
# 🏞️ BuddyTrail
<div align="center">

Welcome to **BuddyTrail** – your ultimate travel companion! 🌍✈️ Whether you're planning a family vacation 👨‍👩‍👧‍👦 or a trip with friends 👫, BuddyTrail helps you discover and explore amazing destinations 🏖️🏰, find the best hotels 🏨, and book affordable flights 💺 with ease.
# `🏞️ BuddyTrail`

<br />
<i>Welcome to **BuddyTrail** – your ultimate travel companion! 🌍✈️ Whether you're planning a family vacation 👨‍👩‍👧‍👦 or a trip with friends 👫, BuddyTrail helps you discover and explore amazing destinations 🏖️🏰, find the best hotels 🏨, and book affordable flights 💺 with ease.
</i>

<div align="center">
<a href="https://github.com/PriyaGhosal/BuddyTrail/stargazers"><img src="https://img.shields.io/github/stars/PriyaGhosal/BuddyTrail" alt="Stars Badge"/></a>
<a href="https://github.com/PriyaGhosal/BuddyTrail/network/members"><img src="https://img.shields.io/github/forks/PriyaGhosal/BuddyTrail" alt="Forks Badge"/></a>
<a href="https://github.com/PriyaGhosal/BuddyTrail/pulls"><img src="https://img.shields.io/github/issues-pr/PriyaGhosal/BuddyTrail" alt="Pull Requests Badge"/></a>
<a href="https://github.com/PriyaGhosal/BuddyTrail/issues"><img src="https://img.shields.io/github/issues/PriyaGhosal/BuddyTrail" alt="Issues Badge"/></a>
<a href="https://github.com/PriyaGhosal/BuddyTrail/graphs/contributors"><img alt="GitHub contributors" src="https://img.shields.io/github/contributors/PriyaGhosal/BuddyTrail?color=2b9348"></a>
</div>


<br />
<div align = "center">
<br>

<table align="center">
<thead align="center">
<tr border: 1px;>
<td><b>🌟 Stars</b></td>
<td><b>🍴 Forks</b></td>
<td><b>🐛 Issues</b></td>
<td><b>🔔 Open PRs</b></td>
<td><b>🔕 Close PRs</b></td>
<td><b>🛠️ Languages</b></td>
<td><b>🌐 Contributors </b></td>
</tr>
</thead>
<tbody>
<tr>
<td><img alt="Stars" src="https://img.shields.io/github/stars/PriyaGhosal/BuddyTrail?style=flat&logo=github"/></td>
<td><img alt="Forks" src="https://img.shields.io/github/forks/PriyaGhosal/BuddyTrail?style=flat&logo=github"/></td>
<td><img alt="Issues" src="https://img.shields.io/github/issues/PriyaGhosal/BuddyTrail?style=flat&logo=github"/></td>
<td><img alt="Open Pull Requests" src="https://img.shields.io/github/issues-pr/PriyaGhosal/BuddyTrail?style=flat&logo=github"/></td>
<td><img alt="Close Pull Requests" src="https://img.shields.io/github/issues-pr-closed/PriyaGhosal/BuddyTrail?style=flat&color=critical&logo=github"/></td>
<td><img alt="GitHub language count" src="https://img.shields.io/github/languages/count/PriyaGhosal/BuddyTrail?style=flat&color=critical&logo=github"></td>
<td><img alt="GitHub contributors" src="https://img.shields.io/github/contributors/PriyaGhosal/BuddyTrail?color=2b9348"></td>
</tr>
</tbody>
</table>
</div>
<br>

# 📸 Website Preview

<img src = "https://github.com/neeru24/Connect_icons/blob/main/Screenshot%202024-10-07%20182908.png" alt = "image">
<img src = "https://github.com/neeru24/Connect_icons/blob/main/Screenshot%202024-10-07%20182935.png" alt = "image">
<img src = "https://github.com/neeru24/Connect_icons/blob/main/Screenshot%202024-10-07%20183005.png" alt = "image">


<br />
<br>

## 🚀 Features

Expand Down Expand Up @@ -58,7 +80,7 @@ Welcome to **BuddyTrail** – your ultimate travel companion! 🌍✈️ Whether
Join the list. **We are waiting** :octocat:<br />
Here's how you can contribute to the repository:

1. **Fork the repository** to your own GitHub account.
1. **[Fork](https://github.com/PriyaGhosal/BuddyTrail/fork) the repository** to your own GitHub account.

2. **Clone the repository** to your local machine:

Expand Down Expand Up @@ -92,16 +114,53 @@ Here's how you can contribute to the repository:
git push origin <your-branch-name>
```

7. **Create a pull request** from your GitHub repository.
</br>
7. **Submit a pull request:**
- Go to the original repository on GitHub.
- Click on the "Pull Requests" tab.
- Click the "New Pull Request" button.
- Select your feature branch and submit the pull request.

8. **Wait for review and feedback.**
- Address any comments or requested changes.
- Once approved, your feature will be merged into the main branch.

<br>

## Project-strucutre 📁

You can find the project structure in the [Project Structure](project-structure.md) file. It contains the details of the project structure and the files present in the project. It will help you to understand the project structure better. 🗂️

<br>

# Big thanks to all the contributors! 🎉
## Contributors

A heartfelt thank you to the following individuals for their valuable contributions to this project. Your support and dedication are greatly appreciated:

<a href="https://github.com/PriyaGhosal/BuddyTrail/graphs/contributors">
<img src="https://contrib.rocks/image?repo=PriyaGhosal/BuddyTrail" />
</a>
<!-- readme: contributors -start -->
<!-- readme: contributors -end -->

<br>

### &#8627; Stargazers

<div align='center'>

[![Stargazers repo roster for @PriyaGhosal/BuddyTrail](https://reporoster.com/stars/PriyaGhosal/BuddyTrail)](https://github.com/PriyaGhosal/BuddyTrail/stargazers)

</div>

### &#8627; Forkers
<div align='center'>

[![Forkers repo roster for @PriyaGhosal/BuddyTrail](https://reporoster.com/forks/PriyaGhosal/BuddyTrail)](https://github.com/PriyaGhosal/BuddyTrail/network/members)

</div>


<div align="right">
<a href="#top">
<img src="https://img.shields.io/badge/Back%20to%20Top-000000?style=for-the-badge&logo=github&logoColor=white" alt="Back to Top">
</a>
</div>

# Thanks for reading!!!
# Thanks for reading!!!
36 changes: 36 additions & 0 deletions project-structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!-- START_STRUCTURE -->
```
├── BuddyTrail
├── Code_of_Conduct.md
├── README.md
├── book.html
├── boy.png
├── chatbot.gif
├── chatbot.html
├── firebase.js
├── icons
│ ├── airplane.svg
│ ├── bed-solid.svg
│ ├── instagram.svg
│ ├── plane-departure-solid.svg
│ ├── route-solid.svg
│ ├── twitter-x.svg
│ ├── twitter.svg
│ └── youtube.svg
├── img
│ ├── banner.png
│ ├── cloud.png
│ ├── contact-mountain.png
│ ├── googleLogo.png
│ ├── landing-page.jpg
│ └── new-york-page.png
├── index.html
├── login.css
├── login.html
├── project-structure.md
├── script.js
├── signUp.css
├── signUp.html
└── style.css
```
<!-- END_STRUCTURE -->

0 comments on commit 41ac141

Please sign in to comment.