Skip to content

Commit 7500df2

Browse files
committed
Review
1 parent a23f1a2 commit 7500df2

File tree

3 files changed

+52
-32
lines changed

3 files changed

+52
-32
lines changed

.github/workflows/cron.yml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,3 @@ jobs:
1111
test:
1212
if: github.repository_owner == 'pypa' # suppress noise in forks
1313
uses: ./.github/workflows/test.yml
14-
15-
update-uv-build-version:
16-
runs-on: ubuntu-latest
17-
permissions:
18-
contents: write
19-
pull-requests: write
20-
steps:
21-
- uses: actions/checkout@v4
22-
- uses: astral-sh/setup-uv@v5
23-
- name: Update uv_build version
24-
id: update_script
25-
run: uv run scripts/update_uv_build_version.py
26-
- # If there are no changes, no pull request will be created and the action exits silently.
27-
name: Create Pull Request
28-
uses: peter-evans/create-pull-request@v7
29-
with:
30-
token: ${{ secrets.GITHUB_TOKEN }}
31-
commit-message: Update uv_build version to ${{ steps.update_script.outputs.version }}
32-
title: Update uv_build version to ${{ steps.update_script.outputs.version }}
33-
body: |
34-
Automated update of uv_build version bounds for uv ${{ steps.update_script.outputs.version }}.
35-
36-
This PR was created automatically by the cron workflow, ping `@konstin` for problems.
37-
branch: bot/update-uv-build-version
38-
delete-branch: true
39-
40-
...
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
3+
name: Cron
4+
5+
on:
6+
schedule:
7+
- cron: "0 6 * * 1" # mondays at 6am
8+
workflow_dispatch:
9+
10+
jobs:
11+
update-uv-build-version:
12+
name: Update uv_build version
13+
if: github.repository_owner == 'pypa' # suppress noise in forks
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Set up uv
21+
uses: astral-sh/setup-uv@v5
22+
- name: Update uv_build version
23+
id: update_script
24+
run: uv run scripts/update_uv_build_version.py
25+
- # If there are no changes, no pull request will be created and the action exits silently.
26+
name: Create Pull Request
27+
uses: peter-evans/create-pull-request@v7
28+
with:
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
commit-message: Update uv_build version to ${{ steps.update_script.outputs.version }}
31+
title: Update uv_build version to ${{ steps.update_script.outputs.version }}
32+
body: |
33+
Automated update of uv_build version bounds for uv ${{ steps.update_script.outputs.version }}.
34+
35+
This PR was created automatically by the cron workflow, ping `@konstin` for problems.
36+
branch: bot/update-uv-build-version
37+
delete-branch: true
38+
39+
...

scripts/update_uv_build_version.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# "packaging>=25.0",
66
# ]
77
# ///
8+
import os
89
import re
910
from pathlib import Path
1011

@@ -36,7 +37,9 @@ def main():
3637
upper_bound = Version(f"{major}.{minor + 1}.{0}")
3738

3839
repository_root = Path(__file__).parent.parent
39-
existing = repository_root.joinpath("source/shared/build-backend-tabs.rst").read_text()
40+
existing = repository_root.joinpath(
41+
"source/shared/build-backend-tabs.rst"
42+
).read_text()
4043
replacement = f'requires = ["uv_build >= {current_release}, <{upper_bound}"]'
4144
searcher = re.compile(re.escape('requires = ["uv_build') + ".*" + re.escape('"]'))
4245
if not searcher.search(existing):
@@ -46,11 +49,16 @@ def main():
4649
if existing != updated:
4750
print("Updating source/shared/build-backend-tabs.rst")
4851
Path("source/shared/build-backend-tabs.rst").write_text(updated)
49-
print(f"::set-output name=version::{current_release}")
50-
print(f"::set-output name=updated::true")
52+
if github_output := os.environ.get("GITHUB_OUTPUT"):
53+
with open(github_output, "a") as f:
54+
f.write(f"version={current_release}\n")
55+
f.write(f"updated=true\n")
5156
else:
5257
print("Already up-to-date source/shared/build-backend-tabs.rst")
53-
print(f"::set-output name=updated::false")
58+
if github_output := os.environ.get("GITHUB_OUTPUT"):
59+
with open(github_output, "a") as f:
60+
f.write(f"updated=false\n")
5461

55-
if __name__ == '__main__':
62+
63+
if __name__ == "__main__":
5664
main()

0 commit comments

Comments
 (0)