Update Contributors #48
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 | |
| on: | |
| schedule: | |
| # ζ―ι±δΈζ©δΈ 9:00 UTC ζ΄ζ°θ²’η»θ ζΈζ | |
| - cron: '0 9 * * 1' | |
| workflow_dispatch: # ε 許ζεθ§ΈηΌ | |
| push: | |
| branches: [ main, dev ] | |
| paths: | |
| - 'scripts/**' | |
| - '.github/workflows/update-contributors.yml' | |
| jobs: | |
| update-contributors: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.8' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install requests | |
| - name: Set up environment variables | |
| run: | | |
| echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV | |
| echo "REPO_OWNER=BabyGrootCICD" >> $GITHUB_ENV | |
| echo "REPO_NAME=Sext-Adventure" >> $GITHUB_ENV | |
| - name: Run contributor tracking script | |
| run: | | |
| python scripts/track_contributors.py | |
| - name: Check for changes | |
| id: check-changes | |
| run: | | |
| if [ -n "$(git status --porcelain)" ]; then | |
| echo "has-changes=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "has-changes=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit and push changes | |
| if: steps.check-changes.outputs.has-changes == 'true' | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add README.md monthly_report_*.md monthly_stats.json | |
| git commit -m "π€ Auto-update: ζ΄ζ°θ²’η»θ ζΈζεζεΊ¦ε ±ε | |
| - ζ΄ζ° README.md δΈηθ²’η»θ εε‘ | |
| - ηζζεΊ¦θ²’η»ε ±ε | |
| - ζ΄ζ°θ²’η»η΅±θ¨ζΈζ | |
| [skip ci]" || exit 0 | |
| git push | |
| - name: Create summary | |
| if: always() | |
| run: | | |
| echo "## π θ²’η»θ ζ΄ζ°ζθ¦" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### β ε·θ‘η΅ζ" >> $GITHUB_STEP_SUMMARY | |
| if [ -f "monthly_stats.json" ]; then | |
| echo "- π ζεΊ¦η΅±θ¨ε·²ζ΄ζ°" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| if [ -f "monthly_report_*.md" ]; then | |
| echo "- π ζεΊ¦ε ±εε·²ηζ" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "- π README.md θ²’η»θ εε‘ε·²ζ΄ζ°" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### π δΈζ¬‘ζ΄ζ°" >> $GITHUB_STEP_SUMMARY | |
| echo "δΈζ¬‘θͺεζ΄ζ°ζιοΌδΈι±δΈ 09:00 UTC" >> $GITHUB_STEP_SUMMARY |