Process JSON Reviews #5
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: Process JSON Reviews | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'reviews/*.json' | |
| workflow_dispatch: # Allow manual trigger | |
| permissions: | |
| contents: write | |
| issues: write | |
| jobs: | |
| process-reviews: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install PyGithub>=2.1.0 | |
| - name: Process JSON reviews and create Issues | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| python scripts/process_json_reviews.py || exit 1 | |
| - name: Commit and push processed files | |
| if: success() || failure() # Run even if previous step failed | |
| run: | | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "GitHub Action" | |
| git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | |
| git add reviews/processed/ || true | |
| if git diff --staged --quiet; then | |
| echo "No processed files to commit" | |
| else | |
| git commit -m "Move processed JSON reviews to processed/ directory [skip ci]" || exit 0 | |
| git push origin HEAD:main || exit 0 | |
| fi | |