Skip to content

Commit

Permalink
Add action for autoupdate requirements.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
selfkilla666 committed Dec 21, 2023
1 parent 298a439 commit 719e952
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/update_requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Update requirements.txt

on:
workflow_dispatch:
push:
paths:
- 'poetry.lock'
- 'pyproject.toml'

jobs:
update-requirements:
name: Update requirements.txt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11
architecture: x64

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Check for changes in poetry.lock
id: check_changes
run: |
git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep poetry.lock || echo "NO_CHANGES"
- name: Update requirements.txt
if: steps.check_changes.outputs.NO_CHANGES != 'NO_CHANGES'
run: |
poetry export --dev --without-hashes -f requirements.txt > requirements.txt
- name: Commit and push changes
if: steps.check_changes.outputs.NO_CHANGES != 'NO_CHANGES'
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git add requirements.txt
git commit -m "Autoupdate requirements.txt (CI)"
git push

0 comments on commit 719e952

Please sign in to comment.