-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add action for autoupdate requirements.txt
- Loading branch information
1 parent
298a439
commit 719e952
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
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
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 |