-
Notifications
You must be signed in to change notification settings - Fork 47
59 lines (51 loc) · 1.73 KB
/
autoupdate-poetry.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# This is a workflow file for GitHub Actions that automatically updates
# the Poetry lock file and creates a pull request if changes are detected.
name: Periodic autoupdate Poetry lock file
on:
schedule:
- cron: "0 9 * * *" # UTC time, runs every day at 9:00 AM
jobs:
autoupdate-poetry-lock:
runs-on: ubuntu-latest
if: github.repository == 'ansible/eda-server'
permissions:
contents: write
pull-requests: write
outputs:
lock-changed: ${{ steps.lock-changed.outputs.lock-changed }}
steps:
- name: Checkout main branch
uses: actions/checkout@v3
with:
ref: main
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Run poetry lock
run: poetry lock
- name: Check if lock file changed
id: lock-changed
run: |
if git diff --exit-code poetry.lock; then
echo "No changes detected"
echo "lock-changed=false" >> $GITHUB_OUTPUT
else
echo "Changes detected"
echo "lock-changed=true" >> $GITHUB_OUTPUT
fi
- name: Create a Pull Request
uses: peter-evans/create-pull-request@v5
if: steps.lock-changed.outputs.lock-changed == 'true'
with:
# TODO: uses eda-ci pat token, replace with a bot.
token: ${{ secrets.EDA_CI_GH_TOKEN }}
branch: autoupdate-poetry-lock
base: main
title: "ci(bot): autoupdate poetry lock file"
body: "This PR updates the poetry lock file with the latest changes."
labels: "run-e2e"