weekly fetch and parse GPU info to API #101
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: weekly fetch and parse GPU info to API | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| schedule: | |
| - cron: '00 00 * * 1' | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository π§ | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.8 | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.8 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Update data | |
| run: | | |
| python update.py | |
| - name: Validate output | |
| run: | | |
| python validators.py gpu.json | |
| - name: Upload logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: gpu-info-logs | |
| path: '*.log' | |
| retention-days: 7 | |
| - name: Commit files | |
| id: commit | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "github-actions" | |
| git add --all | |
| if [ -z "$(git status --porcelain)" ]; then | |
| echo "push=false" >> $GITHUB_OUTPUT | |
| else | |
| git commit -m "Update GPU data - $(date +'%Y-%m-%d')" -a | |
| echo "push=true" >> $GITHUB_OUTPUT | |
| fi | |
| shell: bash | |
| - name: Push changes | |
| if: steps.commit.outputs.push == 'true' | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: gpu-data | |
| force: true |