Repository navigation
Expand file tree
/
Copy pathcompile-python-requirements.yml
More file actions
79 lines (69 loc) · 2.35 KB
/
Copy pathcompile-python-requirements.yml
File metadata and controls
79 lines (69 loc) · 2.35 KB
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
75
76
77
78
79
name: Recompile Python dependencies
on:
workflow_dispatch:
inputs:
branch:
description: "Target branch to create requirements PR against"
required: true
default: "master"
type: string
defaults:
run:
shell: bash # making this explicit opts into -e -o pipefail
jobs:
recompile-python-dependencies:
runs-on: ubuntu-latest
steps:
- name: Check out target branch
uses: actions/checkout@v7
with:
ref: "${{ inputs.branch }}"
- name: Install uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
enable-cache: true
python-version: "3.12"
- name: Run make compile-requirements
env:
PACKAGE: "${{ inputs.package }}"
run: |
make compile-requirements
- name: PR preflight
run: |
if git diff --exit-code; then
# Fail early (and avoid quiet failure of create-pull-request action)
echo "Error: No changes, so not creating PR." | tee -a "$GITHUB_STEP_SUMMARY"
exit 1
fi
- name: Make a PR
id: make-pr
uses: peter-evans/create-pull-request@v8
with:
branch: "${{ github.triggering_actor }}/compile-python-deps"
branch-suffix: short-commit-hash
add-paths: |
requirements
scripts/**/pyproject.toml
scripts/**/uv.lock
scripts/**/requirements*
pyproject.toml
uv.lock
commit-message: |
feat: Recompile Python dependencies
Commit generated by workflow `${{ github.workflow_ref }}`
title: "chore: Recompile Python dependencies"
body: >-
PR generated by workflow `${{ github.workflow_ref }}`
on behalf of @${{ github.triggering_actor }}.
assignees: "${{ github.triggering_actor }}"
reviewers: "${{ github.triggering_actor }}"
- name: Job summary
env:
PR_URL: "${{ steps.make-pr.outputs.pull-request-url }}"
run: |
if [[ -z "$PR_URL" ]]; then
echo "PR not created; see log for more information" | tee -a "$GITHUB_STEP_SUMMARY"
exit 1
else
echo "PR created or updated: $PR_URL" | tee -a "$GITHUB_STEP_SUMMARY"
fi