-
Notifications
You must be signed in to change notification settings - Fork 22
66 lines (57 loc) · 1.88 KB
/
update-docker-requirements.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
name: docker-requirements
on:
pull_request:
paths:
- ".github/workflows/update-docker-requirements.yml"
- "pyproject.toml"
- "requirements-docker.lock"
- "requirements-optional.txt"
workflow_dispatch:
permissions:
pull-requests: write
contents: write
jobs:
update:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup environment
uses: ./.github/actions/setup-env
with:
python-version: "3.11"
optional-dependencies: "false"
- name: Update docker requirements
id: update
run: |
pip-compile \
--quiet \
--strip-extras --output-file=requirements-docker.lock \
pyproject.toml requirements-optional.txt
NEEDS_UPDATE=$(git diff --quiet && echo 'false' || echo 'true')
echo "needs-update=${NEEDS_UPDATE}" | tee --append $GITHUB_OUTPUT
- name: Open a PR to update the requirements
# prettier-ignore
if:
${{ steps.update.outputs.needs-update && github.event_name == 'workflow_dispatch' }}
uses: peter-evans/create-pull-request@v5
with:
commit-message: update requirements-docker.lock
branch: update-docker-requirements
branch-suffix: timestamp
base: ${{ github.head_ref || github.ref_name }}
title: Update requirements-docker.lock
# prettier-ignore
body:
https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
reviewers: ${{ github.actor }}
- name: Show diff
# prettier-ignore
if:
${{ steps.update.outputs.needs-update && github.event_name != 'workflow_dispatch' }}
run: git diff --exit-code