-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (65 loc) · 2.29 KB
/
update_dependencies.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Update dependencies in poetry lockfile
on:
schedule:
- cron: '0 1 * * 1'
workflow_dispatch:
push:
branches: main
paths:
- .github/workflows/update_dependencies.yml
jobs:
update_dependencies:
runs-on: ubuntu-latest
steps:
# Check out repo and set up Python
- uses: actions/checkout@v3
with:
lfs: true
# see https://stackoverflow.com/questions/57612428/cloning-private-github-repository-within-organisation-in-actions
- name: checkout test data
run: |
eval `ssh-agent -s`
ssh-add - <<< '${{ secrets.TEST_DATA_ACCESS_KEY }}'
git submodule sync --recursive
git submodule update --init --recursive
# see https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md
- uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
# Use cached python and dependencies, install poetry
- name: "Setup Python, Poetry and Dependencies"
uses: packetcoders/action-setup-cache-python-poetry@main
with:
python-version: 3.8
poetry-version: 1.8.5
# update poetry lockfile
- name: "Update poetry lock file"
id: update
run: |
poetry self update
exec 5>&1
UPDATE_OUTPUT=$(poetry update|tee >(cat - >&5))
echo "UPDATE_OUTPUT<<EOF" >> $GITHUB_OUTPUT
echo "$UPDATE_OUTPUT" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Obtain git status
id: status
run: |
exec 5>&1
STATUS=$(git status|tee >(cat - >&5))
echo "STATUS<<EOF" >> $GITHUB_OUTPUT
echo "$STATUS" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
# create pull request if necessary
- name: "Create Pull Request"
uses: peter-evans/create-pull-request@v5
if: ${{ contains(steps.status.outputs.STATUS, 'poetry.lock')}}
with:
token: ${{ steps.generate-token.outputs.token }}
commit-message: Update dependencies
title: "Update dependencies"
body: |
Dependency updates using Poetry:
${{ steps.update.outputs.UPDATE_OUTPUT }}