Skip to content

Update Contributors Page #12

Update Contributors Page

Update Contributors Page #12

name: Update Contributors Page
on:
schedule: # execute every day at midnight
- cron: "0 0 * * *"
workflow_dispatch: # Allow manual trigger
permissions:
contents: write
jobs:
update-contributors:
name: 🌟 Update Contributors Page
runs-on: ubuntu-latest
steps:
- name: πŸ“₯ Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: 🐍 Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: πŸ“¦ Install Python dependencies
run: |
echo "πŸ“¦ Installing Python dependencies..."
pip install -r scripts/contributors/requirements.txt
echo "βœ… Dependencies installed"
- name: πŸ” Verify dependencies
run: |
echo "πŸ” Verifying installed packages..."
python3 -c "import requests; print(f'βœ“ requests {requests.__version__}')"
python3 -c "import dotenv; print(f'βœ“ python-dotenv installed')"
echo "βœ… All dependencies verified"
- name: 🌟 Generate contributors page
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "🌟 Generating contributors page..."
echo "πŸ“Š Analyzing repositories..."
cd scripts/contributors
python3 github_contributors.py --web
echo "βœ… Contributors page generated"
- name: πŸ“Š Check if file was generated
run: |
if [ -f "about/contributors.md" ]; then
echo "βœ… Contributors page exists"
echo "πŸ“„ File size: $(stat -f%z about/contributors.md 2>/dev/null || stat -c%s about/contributors.md 2>/dev/null) bytes"
echo ""
echo "πŸ“‹ First 10 lines:"
head -n 10 about/contributors.md
else
echo "❌ Contributors page not found!"
exit 1
fi
- name: πŸ”§ Configure git
run: |
echo "πŸ”§ Configuring git user..."
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
echo "βœ… Git user configured"
- name: πŸ“ Commit and push changes
run: |
echo "🌳 Checking git status..."
git status
echo ""
echo "πŸ“Š Adding contributors page..."
git add about/contributors.md
# Check if there are changes to commit
if git diff --cached --quiet; then
echo "ℹ️ No changes detected in contributors page"
echo "πŸ“Š Page is already up to date"
exit 0
fi
echo "βœ… Changes detected, preparing commit..."
echo ""
echo "πŸ“‹ Files to be committed:"
git diff --cached --name-status
echo ""
echo "πŸ“ Committing changes..."
TIMESTAMP=$(date -u +"%Y-%m-%d %H:%M UTC")
git commit -m "🌟 Update contributors page" \
-m "Automated update of the contributors page" \
-m "Generated on: $TIMESTAMP" \
-m "" \
-m "This commit was automatically created by the Update Contributors workflow."
echo "βœ… Changes committed"
echo ""
echo "πŸš€ Pushing to repository..."
git push origin main || git push origin master
echo "βœ… Changes pushed successfully"
- name: βœ… Workflow summary
if: always()
run: |
echo ""
echo "=========================================="
echo "πŸ“Š Contributors Page Update Summary"
echo "=========================================="
echo ""
if [ -f "about/contributors.md" ]; then
echo "βœ… Contributors page: Generated"
echo "πŸ“ Location: about/contributors.md"
echo "🌐 URL: https://control-toolbox.org/contributors/"
else
echo "❌ Contributors page: Failed to generate"
fi
echo ""
echo "πŸ•’ Workflow completed at: $(date -u +"%Y-%m-%d %H:%M UTC")"
echo "=========================================="