-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from yashksaini-coder/yash/fix-4
Add Update structure workflow
- Loading branch information
Showing
6 changed files
with
187 additions
and
21 deletions.
There are no files selected for viewing
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
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('repo_structure.txt', 'w') as f: | ||
f.write('\n'.join(structure)) | ||
|
||
def update_readme(structure): | ||
with open('README.md', 'r') as f: | ||
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('README.md', 'w') as f: | ||
f.write(new_content) | ||
print("README.md updated with new structure.") | ||
else: | ||
print("Markers not found in README.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("repo_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() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Detect and Update Repo Structure | ||
|
||
on: | ||
schedule: | ||
- cron: '0 * * * *' # Run every hour | ||
workflow_dispatch: # Allow manual triggering | ||
push: | ||
branches: | ||
- main | ||
- yash/fix-4 | ||
|
||
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_dir_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) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ venv/ | |
etc/ | ||
Include/ | ||
Lib/ | ||
Scripts/ | ||
|
||
share/ | ||
pyvenv.cfg | ||
__pycache__\ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Beginner's Guide to Data Science | ||
|
||
## Introduction | ||
|
||
Data Science is an interdisciplinary field that uses scientific methods, processes, algorithms, and systems to extract knowledge and insights from structured and unstructured data. It combines aspects of statistics, computer science, and domain expertise to analyze and interpret complex data. | ||
|
||
### Why Data Science? | ||
|
||
1. **Decision Making**: Helps in making informed decisions based on data analysis. | ||
2. **Predictive Analysis**: Forecasts future trends and behaviors. | ||
3. **Automation**: Automates repetitive tasks and processes. | ||
4. **Innovation**: Drives innovation by uncovering hidden patterns and insights. | ||
|
||
### Key Components | ||
|
||
1. **Data Collection**: Gathering data from various sources. | ||
2. **Data Cleaning**: Removing inconsistencies and errors from the data. | ||
3. **Data Analysis**: Applying statistical and computational techniques to analyze data. | ||
4. **Data Visualization**: Representing data in graphical formats for better understanding. | ||
5. **Machine Learning**: Building models that can learn from data and make predictions. | ||
|
||
### Tools and Technologies | ||
|
||
- **Programming Languages**: Python, R | ||
- **Libraries**: Pandas, NumPy, Scikit-Learn, TensorFlow | ||
- **Visualization Tools**: Matplotlib, Seaborn, Tableau | ||
- **Databases**: SQL, NoSQL | ||
|
||
### Getting Started | ||
|
||
1. **Learn Programming**: Start with Python or R. | ||
2. **Understand Statistics**: Basic statistical concepts are crucial. | ||
3. **Practice with Data Sets**: Use platforms like Kaggle to practice. | ||
4. **Build Projects**: Apply your skills to real-world problems. | ||
|
||
### Resources | ||
|
||
- **Books**: "Python for Data Analysis" by Wes McKinney | ||
- **Online Courses**: Coursera, edX, Udacity | ||
- **Communities**: Stack Overflow, Reddit, Data Science Meetups | ||
|
||
Data Science is a rapidly evolving field with vast opportunities. Start your journey today and explore the endless possibilities that data has to offer! |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
├── Advanced_Projects | ||
├── Algorithms_and_Data_Structures | ||
├── Automation_Tools | ||
├── Beginner_Projects | ||
├── Blockchain_Development | ||
├── CODE_OF_CONDUCT.md | ||
├── CONTRIBUTING.md | ||
├── Cybersecurity_Tools | ||
├── Data_Science | ||
│ └── Data-science.md | ||
├── Deep_Learning | ||
├── Game_Development | ||
├── LICENSE | ||
├── Machine_Learning | ||
├── PROJECT-README-TEMPLATE.md | ||
├── README.md | ||
├── Tutorials | ||
├── Web_Development | ||
└── repo_structure.txt |