Consumer #2049
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: Consumer | |
| on: | |
| schedule: | |
| - cron: '0 * * * *' # Every hour | |
| workflow_dispatch: # This allows you to manually trigger the workflow from the Actions tab. | |
| permissions: | |
| contents: write # Ensure the workflow has write access to contents | |
| jobs: | |
| fetch-data: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 # Updated to v4 for latest features | |
| with: | |
| fetch-depth: 0 # Fetch all history for all branches | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Profile generation | |
| run: | | |
| python -m venv venv | |
| source venv/bin/activate | |
| pip install -r requirements.txt | |
| git checkout -b data --track origin/data || git checkout data | |
| python manage.py fetch | |
| python manage.py build | |
| env: | |
| API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
| GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }} | |
| - name: Commit and push changes if there are any | |
| run: | | |
| git config --global user.name 'devb' | |
| git config --global user.email '[email protected]' | |
| git add docs/* | |
| git add data/* | |
| git diff --quiet && git diff --staged --quiet || (git commit -m "Update data" && git push origin data) | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |