Update Contributors Page #12
This file contains hidden or 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
| 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 "==========================================" |