Skip to content

Commit

Permalink
auto index
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberBoyAyush committed Jun 16, 2024
1 parent ff8d821 commit 9fbf938
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/index-files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Index Files

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Generate file index
run: |
python generate_index.py
- name: Commit and push changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add index.txt
git commit -m 'Update file index'
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12 changes: 12 additions & 0 deletions generate_index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import os

def generate_index():
with open('index.txt', 'w') as f:
for root, dirs, files in os.walk('.'):
for file in files:
if '.git' not in root: # Exclude .git directory
file_path = os.path.join(root, file)
f.write(file_path + '\n')

if __name__ == "__main__":
generate_index()

0 comments on commit 9fbf938

Please sign in to comment.