Scrape Errors #404
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: Scrape Errors | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 0 * * *' # Run daily at midnight UTC | |
| jobs: | |
| scrape_and_commit: | |
| name: Scrape and Update Error Lists | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 1 | |
| - name: Set up Python 3.9 | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: '3.9' | |
| - name: Install Python dependencies and run scripts | |
| run: | | |
| set -e # Exit immediately if a command exits with a non-zero status | |
| echo "-------------------- Installing dependencies --------------------" | |
| cd compiler/errors/ | |
| python -m pip install --upgrade pip setuptools wheel | |
| python -m pip install requests==2.28.1 | |
| echo "-------------------- Running scrape script --------------------" | |
| python sort.py scrape | |
| echo "-------------------- Running sort script --------------------" | |
| python sort.py sort | |
| - name: Check for changes and commit | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "GitHub Actions Bot" | |
| if ! git diff --quiet; then # Check if there are any changes | |
| echo "Changes detected in error files." | |
| git add . | |
| git commit -m "Automated update of unknown_errors" | |
| echo "Committing and pushing changes..." | |
| git push origin main | |
| else | |
| echo "No changes detected in error files. Skipping commit and push." | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |