Data class update #32
Workflow file for this run
This file contains 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 Requirements | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
update-requirements: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install pipreqs | |
run: pip install pipreqs | |
- name: Generate requirements.txt | |
run: pipreqs . --force | |
- name: Check for changes in requirements.txt | |
id: requirements_changed | |
run: | | |
git diff --exit-code requirements.txt || echo "requirements_changed=true" >> $GITHUB_OUTPUT | |
- name: Commit and push changes | |
if: steps.requirements_changed.outputs.requirements_changed == 'true' | |
env: | |
PAT_TOKEN: ${{ secrets.PAT_TOKEN }} | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@github.com" | |
git add requirements.txt | |
git commit -m "Update requirements.txt" | |
git push https://${PAT_TOKEN}@github.com/${{ github.repository }} HEAD:${{ github.ref }} | |
- name: Check dependencies availability | |
run: pip install --no-cache-dir -r requirements.txt |