Skip to content

Commit d97b4ec

Browse files
authored
Create update-poetry-lock.yml
1 parent f499d67 commit d97b4ec

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# .github/workflows/update-poetry-lock.yml
2+
name: Update poetry.lock
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
auto_commit:
8+
description: "Автоматически закоммитить poetry.lock в текущую ветку"
9+
required: false
10+
type: boolean
11+
default: false
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
update-lock:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.10"
28+
29+
- name: Install Poetry
30+
run: |
31+
pipx install poetry
32+
33+
- name: Remove stale lock (if exists)
34+
run: |
35+
rm -f poetry.lock
36+
37+
- name: Generate poetry.lock
38+
run: |
39+
poetry lock --no-update
40+
echo "--- poetry.lock generated successfully ---"
41+
42+
- name: Upload poetry.lock as artifact
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: poetry-lock-${{ github.ref_name }}-${{ github.run_id }}
46+
path: poetry.lock
47+
retention-days: 30
48+
49+
- name: Commit & push poetry.lock
50+
if: ${{ inputs.auto_commit }}
51+
run: |
52+
git config user.name "github-actions[bot]"
53+
git config user.email "github-actions[bot]@users.noreply.github.com"
54+
55+
git add poetry.lock
56+
57+
if git diff --cached --quiet; then
58+
echo "poetry.lock не изменился — коммит не нужен."
59+
else
60+
git commit -m "chore: update poetry.lock [skip ci]"
61+
git push
62+
fi

0 commit comments

Comments
 (0)