repoutils 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- repoutils-0.1.0/.github/actions/prepare-publish/action.yml +47 -0
- repoutils-0.1.0/.github/dependabot.yml +34 -0
- repoutils-0.1.0/.github/jactionlint.yaml +9 -0
- repoutils-0.1.0/.github/workflows/actions.lock +110 -0
- repoutils-0.1.0/.github/workflows/attestations.yml +89 -0
- repoutils-0.1.0/.github/workflows/autofix-comment.yml +65 -0
- repoutils-0.1.0/.github/workflows/bump-version.yml +75 -0
- repoutils-0.1.0/.github/workflows/ci.yml +421 -0
- repoutils-0.1.0/.github/workflows/claude-code-review.yml +207 -0
- repoutils-0.1.0/.github/workflows/claude.yml +214 -0
- repoutils-0.1.0/.github/workflows/fix.yml +107 -0
- repoutils-0.1.0/.github/workflows/publish-pypi.yml +207 -0
- repoutils-0.1.0/.github/workflows/testpypi-comment.yml +115 -0
- repoutils-0.1.0/.gitignore +10 -0
- repoutils-0.1.0/.python-version +1 -0
- repoutils-0.1.0/AGENTS.md +59 -0
- repoutils-0.1.0/CLAUDE.md +1 -0
- repoutils-0.1.0/LICENSE +21 -0
- repoutils-0.1.0/PKG-INFO +98 -0
- repoutils-0.1.0/README.md +83 -0
- repoutils-0.1.0/justfile +180 -0
- repoutils-0.1.0/pyproject.toml +106 -0
- repoutils-0.1.0/src/repoutils/__init__.py +1 -0
- repoutils-0.1.0/src/repoutils/__main__.py +5 -0
- repoutils-0.1.0/src/repoutils/cli.py +96 -0
- repoutils-0.1.0/src/repoutils/commands/__init__.py +1 -0
- repoutils-0.1.0/src/repoutils/commands/check_attestations.py +59 -0
- repoutils-0.1.0/src/repoutils/commands/check_blame_ignore_revs.py +69 -0
- repoutils-0.1.0/src/repoutils/commands/check_checkout_credentials.py +52 -0
- repoutils-0.1.0/src/repoutils/commands/check_lock_platforms.py +146 -0
- repoutils-0.1.0/src/repoutils/commands/check_pins.py +177 -0
- repoutils-0.1.0/src/repoutils/commands/check_screenshots_dir.py +76 -0
- repoutils-0.1.0/src/repoutils/commands/check_sentence_per_line.py +109 -0
- repoutils-0.1.0/src/repoutils/commands/check_whitespace.py +75 -0
- repoutils-0.1.0/src/repoutils/commands/claude_route.py +52 -0
- repoutils-0.1.0/src/repoutils/commands/dependabot_relock.py +89 -0
- repoutils-0.1.0/src/repoutils/commands/git_config_setup.py +72 -0
- repoutils-0.1.0/src/repoutils/commands/long_files.py +313 -0
- repoutils-0.1.0/src/repoutils/commands/post_comment.py +94 -0
- repoutils-0.1.0/src/repoutils/commands/post_patch_coverage.py +255 -0
- repoutils-0.1.0/src/repoutils/commands/post_screenshots.py +159 -0
- repoutils-0.1.0/src/repoutils/commands/recreate_pr.py +230 -0
- repoutils-0.1.0/src/repoutils/commands/requirements_min_versions.py +165 -0
- repoutils-0.1.0/src/repoutils/commands/wait_for_base_coverage.py +203 -0
- repoutils-0.1.0/src/repoutils/config.py +70 -0
- repoutils-0.1.0/src/repoutils/github.py +170 -0
- repoutils-0.1.0/src/repoutils/py.typed +0 -0
- repoutils-0.1.0/tests/__init__.py +0 -0
- repoutils-0.1.0/tests/test_check_attestations.py +63 -0
- repoutils-0.1.0/tests/test_check_blame_ignore_revs.py +109 -0
- repoutils-0.1.0/tests/test_check_checkout_credentials.py +89 -0
- repoutils-0.1.0/tests/test_check_lock_platforms.py +158 -0
- repoutils-0.1.0/tests/test_check_pins.py +204 -0
- repoutils-0.1.0/tests/test_check_screenshots_dir.py +114 -0
- repoutils-0.1.0/tests/test_check_sentence_per_line.py +83 -0
- repoutils-0.1.0/tests/test_check_whitespace.py +95 -0
- repoutils-0.1.0/tests/test_claude_route.py +91 -0
- repoutils-0.1.0/tests/test_cli.py +173 -0
- repoutils-0.1.0/tests/test_config.py +55 -0
- repoutils-0.1.0/tests/test_dependabot_relock.py +105 -0
- repoutils-0.1.0/tests/test_git_config_setup.py +61 -0
- repoutils-0.1.0/tests/test_github.py +136 -0
- repoutils-0.1.0/tests/test_long_files.py +357 -0
- repoutils-0.1.0/tests/test_post_comment.py +175 -0
- repoutils-0.1.0/tests/test_post_patch_coverage.py +318 -0
- repoutils-0.1.0/tests/test_post_screenshots.py +235 -0
- repoutils-0.1.0/tests/test_recreate_pr.py +191 -0
- repoutils-0.1.0/tests/test_requirements_min_versions.py +149 -0
- repoutils-0.1.0/tests/test_wait_for_base_coverage.py +259 -0
- repoutils-0.1.0/uv.lock +464 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: Prepare publish
|
|
2
|
+
description: >-
|
|
3
|
+
Installs uv and just, downloads the build job's dist artifact into dist/,
|
|
4
|
+
signs a PEP 740 publish attestation for each file in it with attest-action,
|
|
5
|
+
and checks every file has one, ready for uv publish.
|
|
6
|
+
|
|
7
|
+
# The publish jobs in publish-pypi.yml run this after their own
|
|
8
|
+
# actions/checkout (which has to come first, as this action lives in the
|
|
9
|
+
# checkout) and before uv publish, and the Attestations workflow
|
|
10
|
+
# (attestations.yml) runs it to check on PRs that attesting still works.
|
|
11
|
+
#
|
|
12
|
+
# A composite action's steps run inside the calling job, unlike a reusable
|
|
13
|
+
# workflow's, so attest-action signs with the calling workflow's identity:
|
|
14
|
+
# the OIDC token's workflow_ref is still publish-pypi.yml, which the trusted
|
|
15
|
+
# publishers name. The calling job needs id-token: write.
|
|
16
|
+
runs:
|
|
17
|
+
using: composite
|
|
18
|
+
steps:
|
|
19
|
+
# Keep version in step with pyproject.toml's [tool.uv] required-version.
|
|
20
|
+
- name: Install uv
|
|
21
|
+
uses: astral-sh/setup-uv@v10.3.3
|
|
22
|
+
with:
|
|
23
|
+
version: "0.13.6"
|
|
24
|
+
|
|
25
|
+
# Keep just-version in step with the justfile's minimum-version.
|
|
26
|
+
- name: Install just
|
|
27
|
+
uses: extractions/setup-just@v4.0.0
|
|
28
|
+
with:
|
|
29
|
+
just-version: "1.58.0"
|
|
30
|
+
|
|
31
|
+
- name: Download distributions
|
|
32
|
+
uses: actions/download-artifact@v8.0.2
|
|
33
|
+
with:
|
|
34
|
+
name: dist
|
|
35
|
+
path: dist/
|
|
36
|
+
|
|
37
|
+
# Signs a PEP 740 publish attestation for each file in dist/ with the
|
|
38
|
+
# calling workflow's identity (the trusted publisher), which uv publish
|
|
39
|
+
# uploads alongside it; the index shows them as the release's provenance.
|
|
40
|
+
- name: Generate attestations
|
|
41
|
+
uses: astral-sh/attest-action@v0.0.7
|
|
42
|
+
|
|
43
|
+
# uv publish uploads without attestations if they're missing, so stop
|
|
44
|
+
# here rather than publish a release with no provenance.
|
|
45
|
+
- name: Check every distribution has an attestation
|
|
46
|
+
shell: bash
|
|
47
|
+
run: just check-attestations
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# .github/workflows/actions.lock pins the actions the workflows use to commits;
|
|
2
|
+
# Dependabot regenerates its entries along with each bump. The cooldown skips releases younger than a week, so a
|
|
3
|
+
# compromised release has time to be noticed and pulled before it lands here.
|
|
4
|
+
version: 2
|
|
5
|
+
updates:
|
|
6
|
+
# "/" covers .github/workflows; the local composite actions in
|
|
7
|
+
# .github/actions need listing too, as Dependabot reads only the action.yml
|
|
8
|
+
# of each directory listed.
|
|
9
|
+
- package-ecosystem: github-actions
|
|
10
|
+
directories:
|
|
11
|
+
- /
|
|
12
|
+
- /.github/actions/*
|
|
13
|
+
schedule:
|
|
14
|
+
interval: weekly
|
|
15
|
+
cooldown:
|
|
16
|
+
default-days: 7
|
|
17
|
+
labels:
|
|
18
|
+
- dependencies
|
|
19
|
+
- type:maintenance
|
|
20
|
+
|
|
21
|
+
# repoutils has no runtime dependencies, so this updates the dev group, in one PR.
|
|
22
|
+
- package-ecosystem: uv
|
|
23
|
+
directory: /
|
|
24
|
+
schedule:
|
|
25
|
+
interval: weekly
|
|
26
|
+
cooldown:
|
|
27
|
+
default-days: 7
|
|
28
|
+
groups:
|
|
29
|
+
dev:
|
|
30
|
+
patterns:
|
|
31
|
+
- "*"
|
|
32
|
+
labels:
|
|
33
|
+
- dependencies
|
|
34
|
+
- type:maintenance
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# The correctness profile (what actionlint checks), plus the Dependabot rules
|
|
2
|
+
# from the default profile: a cooldown on every update, and no
|
|
3
|
+
# insecure-external-code-execution. unpinned-uses stays off, as actions are
|
|
4
|
+
# pinned to commits by .github/workflows/actions.lock rather than in the
|
|
5
|
+
# workflows themselves.
|
|
6
|
+
profile: correctness
|
|
7
|
+
rules:
|
|
8
|
+
dependabot-cooldown: error
|
|
9
|
+
dependabot-execution: error
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# This file is machine-generated by `gh actions-lock`.
|
|
2
|
+
# Do not edit by hand; run `gh actions-lock` to update.
|
|
3
|
+
# Docs: https://gh.io/actions-lockfile
|
|
4
|
+
version: 'v0.0.3'
|
|
5
|
+
workflows:
|
|
6
|
+
'.github/workflows/attestations.yml':
|
|
7
|
+
- 'actions/checkout@v7.0.1'
|
|
8
|
+
- 'actions/download-artifact@v8.0.2'
|
|
9
|
+
- 'actions/upload-artifact@v7.0.2'
|
|
10
|
+
- 'astral-sh/attest-action@v0.0.7'
|
|
11
|
+
- 'astral-sh/setup-uv@v10.3.3'
|
|
12
|
+
- 'extractions/setup-just@v4.0.0'
|
|
13
|
+
'.github/workflows/autofix-comment.yml': []
|
|
14
|
+
'.github/workflows/bump-version.yml':
|
|
15
|
+
- 'actions/checkout@v7.0.1'
|
|
16
|
+
- 'astral-sh/setup-uv@v10.3.3'
|
|
17
|
+
'.github/workflows/ci.yml':
|
|
18
|
+
- 'actions/checkout@v7.0.1'
|
|
19
|
+
- 'actions/download-artifact@v8.0.2'
|
|
20
|
+
- 'actions/upload-artifact@v7.0.2'
|
|
21
|
+
- 'astral-sh/setup-uv@v10.3.3'
|
|
22
|
+
- 'codecov/codecov-action@v7.1.1'
|
|
23
|
+
- 'extractions/setup-just@v4.0.0'
|
|
24
|
+
'.github/workflows/claude-code-review.yml':
|
|
25
|
+
- 'actions/checkout@v7.0.1'
|
|
26
|
+
- 'anthropics/claude-code-action@v1.0.266'
|
|
27
|
+
'.github/workflows/claude.yml':
|
|
28
|
+
- 'actions/checkout@v7.0.1'
|
|
29
|
+
- 'anthropics/claude-code-action@v1.0.266'
|
|
30
|
+
'.github/workflows/fix.yml':
|
|
31
|
+
- 'actions/checkout@v7.0.1'
|
|
32
|
+
- 'astral-sh/setup-uv@v10.3.3'
|
|
33
|
+
- 'extractions/setup-just@v4.0.0'
|
|
34
|
+
'.github/workflows/publish-pypi.yml':
|
|
35
|
+
- 'actions/checkout@v7.0.1'
|
|
36
|
+
- 'actions/download-artifact@v8.0.2'
|
|
37
|
+
- 'actions/upload-artifact@v7.0.2'
|
|
38
|
+
- 'astral-sh/attest-action@v0.0.7'
|
|
39
|
+
- 'astral-sh/setup-uv@v10.3.3'
|
|
40
|
+
- 'extractions/setup-just@v4.0.0'
|
|
41
|
+
'.github/workflows/testpypi-comment.yml': []
|
|
42
|
+
dependencies:
|
|
43
|
+
'actions/checkout@v7.0.1':
|
|
44
|
+
ref: 'v7.0.1'
|
|
45
|
+
commit: 'sha1-3d3c42e5aac5ba805825da76410c181273ba90b1'
|
|
46
|
+
owner_id: 44036562
|
|
47
|
+
repo_id: 197814629
|
|
48
|
+
'actions/download-artifact@v8.0.2':
|
|
49
|
+
ref: 'v8.0.2'
|
|
50
|
+
commit: 'sha1-9000827ccba6bdab643e8b6fd33ac0654aef8333'
|
|
51
|
+
owner_id: 44036562
|
|
52
|
+
repo_id: 192626254
|
|
53
|
+
'actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd':
|
|
54
|
+
ref: 'v8.0.0'
|
|
55
|
+
commit: 'sha1-ed597411d8f924073f98dfc5c65a23a2325f34cd'
|
|
56
|
+
owner_id: 44036562
|
|
57
|
+
repo_id: 205262760
|
|
58
|
+
'actions/upload-artifact@v7.0.2':
|
|
59
|
+
ref: 'v7.0.2'
|
|
60
|
+
commit: 'sha1-cf430e030ddbb5b0abf93d22962f4752f3646cd9'
|
|
61
|
+
owner_id: 44036562
|
|
62
|
+
repo_id: 192625955
|
|
63
|
+
'anthropics/claude-code-action@v1.0.266':
|
|
64
|
+
ref: 'v1.0.266'
|
|
65
|
+
commit: 'sha1-d535f5172dec02b204866b393d6b20b9b2aaf98d'
|
|
66
|
+
owner_id: 76263028
|
|
67
|
+
repo_id: 986421638
|
|
68
|
+
uses:
|
|
69
|
+
- 'oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6'
|
|
70
|
+
'astral-sh/attest-action@v0.0.7':
|
|
71
|
+
ref: 'v0.0.7'
|
|
72
|
+
commit: 'sha1-39b6ce43875c196a579e31635b11aa2a2036384a'
|
|
73
|
+
owner_id: 115962839
|
|
74
|
+
repo_id: 1101470881
|
|
75
|
+
uses:
|
|
76
|
+
- 'astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7'
|
|
77
|
+
'astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7':
|
|
78
|
+
ref: 'v10.2.0'
|
|
79
|
+
commit: 'sha1-c18668ad3cf93ea998bef934396af7bb5c839dc7'
|
|
80
|
+
owner_id: 115962839
|
|
81
|
+
repo_id: 846733598
|
|
82
|
+
'astral-sh/setup-uv@v10.3.3':
|
|
83
|
+
ref: 'v10.3.3'
|
|
84
|
+
commit: 'sha1-68559e99cc807c1eb7e9238fd43a15bba460eec2'
|
|
85
|
+
owner_id: 115962839
|
|
86
|
+
repo_id: 846733598
|
|
87
|
+
'codecov/codecov-action@v7.1.1':
|
|
88
|
+
ref: 'v7.1.1'
|
|
89
|
+
commit: 'sha1-303a32d7a59b442fa8d48b6a1cc6825c09c847a5'
|
|
90
|
+
owner_id: 8226205
|
|
91
|
+
repo_id: 200299178
|
|
92
|
+
uses:
|
|
93
|
+
- 'actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd'
|
|
94
|
+
'extractions/setup-crate@0551596312d4008a6dfbc4d3c38fa20eaef46d2d':
|
|
95
|
+
ref: 'v2.0.0'
|
|
96
|
+
commit: 'sha1-0551596312d4008a6dfbc4d3c38fa20eaef46d2d'
|
|
97
|
+
owner_id: 64203070
|
|
98
|
+
repo_id: 341105718
|
|
99
|
+
'extractions/setup-just@v4.0.0':
|
|
100
|
+
ref: 'v4.0.0'
|
|
101
|
+
commit: 'sha1-53165ef7e734c5c07cb06b3c8e7b647c5aa16db3'
|
|
102
|
+
owner_id: 64203070
|
|
103
|
+
repo_id: 258510356
|
|
104
|
+
uses:
|
|
105
|
+
- 'extractions/setup-crate@0551596312d4008a6dfbc4d3c38fa20eaef46d2d'
|
|
106
|
+
'oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6':
|
|
107
|
+
ref: 'v2.2.0'
|
|
108
|
+
commit: 'sha1-0c5077e51419868618aeaa5fe8019c62421857d6'
|
|
109
|
+
owner_id: 108928776
|
|
110
|
+
repo_id: 512644635
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
name: Attestations
|
|
2
|
+
|
|
3
|
+
# Checks on PRs that the publish jobs in publish-pypi.yml can still attest a
|
|
4
|
+
# build, so a change that breaks it (an attest-action bump, an edit to the
|
|
5
|
+
# publish workflow or the build settings) shows up before a release rather
|
|
6
|
+
# than during one. It builds, then runs the prepare-publish action the publish
|
|
7
|
+
# jobs run (which signs PEP 740 publish attestations with attest-action and
|
|
8
|
+
# checks every file has one), then stops: it never uploads, and neither
|
|
9
|
+
# index's trusted publisher names this workflow file, so its token can't
|
|
10
|
+
# publish anyway. Sigstore signs for any GitHub OIDC identity, so this tests
|
|
11
|
+
# everything but the upload. Each run adds an entry to Sigstore's public
|
|
12
|
+
# transparency log.
|
|
13
|
+
#
|
|
14
|
+
# Keep its build job in step with publish-pypi.yml's.
|
|
15
|
+
on:
|
|
16
|
+
pull_request:
|
|
17
|
+
paths:
|
|
18
|
+
- .github/actions/prepare-publish/**
|
|
19
|
+
- .github/workflows/attestations.yml
|
|
20
|
+
- .github/workflows/publish-*.yml
|
|
21
|
+
- pyproject.toml
|
|
22
|
+
- justfile
|
|
23
|
+
- src/repoutils/commands/check_attestations.py
|
|
24
|
+
workflow_dispatch:
|
|
25
|
+
|
|
26
|
+
# A new push to the PR cancels the run for the one before, so a superseded
|
|
27
|
+
# commit doesn't go on to sign (and add a transparency log entry). Set on the
|
|
28
|
+
# workflow so a cancelled run's attest job is cancelled too; a manual run gets
|
|
29
|
+
# a group of its own, so it never cancels or waits for another.
|
|
30
|
+
concurrency:
|
|
31
|
+
group: ${{ github.event_name == 'pull_request' && format('attestations.yml-{0}', github.event.pull_request.number) || github.run_id }}
|
|
32
|
+
cancel-in-progress: true
|
|
33
|
+
|
|
34
|
+
jobs:
|
|
35
|
+
# Builds without id-token: write, as publish-pypi.yml's build job does, so
|
|
36
|
+
# the build steps (and the build backend they install) can't mint a token.
|
|
37
|
+
# That keeps only the build away from it: the attest job still runs the PR's
|
|
38
|
+
# justfile and check command with the token, and a same-repo PR can edit this
|
|
39
|
+
# workflow anyway, so the split isn't a boundary against the PR's author.
|
|
40
|
+
build:
|
|
41
|
+
# A fork PR's run gets no OIDC token, so attest-action can't sign there.
|
|
42
|
+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
permissions:
|
|
45
|
+
contents: read
|
|
46
|
+
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/checkout@v7.0.1
|
|
49
|
+
with:
|
|
50
|
+
persist-credentials: false
|
|
51
|
+
|
|
52
|
+
# Keep version in step with pyproject.toml's [tool.uv] required-version.
|
|
53
|
+
- name: Install uv
|
|
54
|
+
uses: astral-sh/setup-uv@v10.3.3
|
|
55
|
+
with:
|
|
56
|
+
version: "0.13.6"
|
|
57
|
+
|
|
58
|
+
# Keep just-version in step with the justfile's minimum-version.
|
|
59
|
+
- name: Install just
|
|
60
|
+
uses: extractions/setup-just@v4.0.0
|
|
61
|
+
with:
|
|
62
|
+
just-version: "1.58.0"
|
|
63
|
+
|
|
64
|
+
- name: Build package
|
|
65
|
+
run: just build
|
|
66
|
+
|
|
67
|
+
- name: Upload distributions
|
|
68
|
+
uses: actions/upload-artifact@v7.0.2
|
|
69
|
+
with:
|
|
70
|
+
name: dist
|
|
71
|
+
path: dist/
|
|
72
|
+
if-no-files-found: error
|
|
73
|
+
overwrite: true
|
|
74
|
+
|
|
75
|
+
attest:
|
|
76
|
+
needs: build
|
|
77
|
+
runs-on: ubuntu-latest
|
|
78
|
+
permissions:
|
|
79
|
+
contents: read
|
|
80
|
+
id-token: write
|
|
81
|
+
|
|
82
|
+
steps:
|
|
83
|
+
- uses: actions/checkout@v7.0.1
|
|
84
|
+
with:
|
|
85
|
+
persist-credentials: false
|
|
86
|
+
|
|
87
|
+
# The same steps the publish jobs run before uv publish.
|
|
88
|
+
- name: Prepare publish
|
|
89
|
+
uses: $/.github/actions/prepare-publish
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
name: PR Fixes on comment
|
|
2
|
+
|
|
3
|
+
# A PR comment from the repo owner (or, in an organization, a member) that is
|
|
4
|
+
# just `/autofix` (whitespace aside) runs the PR Fixes workflow (fix.yml) on
|
|
5
|
+
# the PR's branch, as running it by hand would. This runs no code from the branch.
|
|
6
|
+
on:
|
|
7
|
+
issue_comment:
|
|
8
|
+
types: [created]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
dispatch:
|
|
12
|
+
# A cheap pre-filter; the exact match is checked below, as expressions
|
|
13
|
+
# can't trim whitespace.
|
|
14
|
+
# OWNER is a user-owned repository's owner; in an organization's
|
|
15
|
+
# repository its members, owners included, are MEMBER.
|
|
16
|
+
if: >-
|
|
17
|
+
github.event.issue.pull_request &&
|
|
18
|
+
contains(fromJSON('["OWNER", "MEMBER"]'), github.event.comment.author_association) &&
|
|
19
|
+
contains(github.event.comment.body, '/autofix')
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
permissions:
|
|
22
|
+
actions: write
|
|
23
|
+
pull-requests: write
|
|
24
|
+
timeout-minutes: 5
|
|
25
|
+
|
|
26
|
+
steps:
|
|
27
|
+
- name: Check the comment is only /autofix
|
|
28
|
+
id: check-comment
|
|
29
|
+
env:
|
|
30
|
+
BODY: ${{ github.event.comment.body }}
|
|
31
|
+
run: |
|
|
32
|
+
if [[ $BODY =~ ^[[:space:]]*/autofix[[:space:]]*$ ]]; then
|
|
33
|
+
echo "matched=true" >> "$GITHUB_OUTPUT"
|
|
34
|
+
else
|
|
35
|
+
echo "Comment has more than /autofix in it; not running PR Fixes."
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
- name: Run PR Fixes on the PR's branch
|
|
39
|
+
if: steps.check-comment.outputs.matched == 'true'
|
|
40
|
+
env:
|
|
41
|
+
GH_TOKEN: ${{ github.token }}
|
|
42
|
+
NUMBER: ${{ github.event.issue.number }}
|
|
43
|
+
COMMENT_ID: ${{ github.event.comment.id }}
|
|
44
|
+
run: |
|
|
45
|
+
# Not read from a process substitution, whose failure wouldn't stop the step.
|
|
46
|
+
pr=$(gh pr view "$NUMBER" --repo "$GITHUB_REPOSITORY" \
|
|
47
|
+
--json state,isCrossRepository,headRefName \
|
|
48
|
+
--jq '"\(.state) \(.isCrossRepository) \(.headRefName)"')
|
|
49
|
+
read -r state cross_repo branch <<< "$pr"
|
|
50
|
+
if [ "$state" != OPEN ]; then
|
|
51
|
+
echo "::error::Pull request #$NUMBER is not open."
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
if [ "$cross_repo" != false ]; then
|
|
55
|
+
echo "::error::Pull request #$NUMBER is from a fork, which PR Fixes can't push to."
|
|
56
|
+
exit 1
|
|
57
|
+
fi
|
|
58
|
+
gh workflow run fix.yml --repo "$GITHUB_REPOSITORY" --ref "$branch"
|
|
59
|
+
# PR Fixes has started, so a failed reaction only warns: a red run would
|
|
60
|
+
# suggest commenting again.
|
|
61
|
+
if ! gh api --method POST "repos/$GITHUB_REPOSITORY/issues/comments/$COMMENT_ID/reactions" \
|
|
62
|
+
-f content=rocket > /dev/null; then
|
|
63
|
+
echo "::warning::Couldn't react to the comment."
|
|
64
|
+
fi
|
|
65
|
+
echo "Started PR Fixes on $branch."
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
name: Bump Version
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
bump:
|
|
7
|
+
description: 'Version bump level'
|
|
8
|
+
required: true
|
|
9
|
+
default: 'patch'
|
|
10
|
+
type: choice
|
|
11
|
+
options:
|
|
12
|
+
- patch
|
|
13
|
+
- minor
|
|
14
|
+
- major
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
bump-version:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
permissions:
|
|
20
|
+
contents: write
|
|
21
|
+
pull-requests: write
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v7.0.1
|
|
25
|
+
with:
|
|
26
|
+
token: ${{ secrets.GH_ACTIONS_TOKEN }}
|
|
27
|
+
# The branch push below uses the stored token.
|
|
28
|
+
persist-credentials: true
|
|
29
|
+
ref: main
|
|
30
|
+
fetch-depth: 0
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# Keep version in step with pyproject.toml's [tool.uv] required-version.
|
|
34
|
+
- name: Install uv
|
|
35
|
+
uses: astral-sh/setup-uv@v10.3.3
|
|
36
|
+
with:
|
|
37
|
+
version: "0.13.6"
|
|
38
|
+
|
|
39
|
+
- name: Bump version
|
|
40
|
+
run: uv version --bump=${{ github.event.inputs.bump }}
|
|
41
|
+
|
|
42
|
+
- name: Get new version
|
|
43
|
+
id: get_version
|
|
44
|
+
run: |
|
|
45
|
+
VERSION="$(uv version --short)"
|
|
46
|
+
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
|
47
|
+
|
|
48
|
+
- name: Create release branch
|
|
49
|
+
run: |
|
|
50
|
+
git config user.name "github-actions[bot]"
|
|
51
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
52
|
+
git checkout -b release-version-${{ steps.get_version.outputs.version }}
|
|
53
|
+
|
|
54
|
+
- name: Commit version bump
|
|
55
|
+
run: |
|
|
56
|
+
git add -u
|
|
57
|
+
git commit -m "Bump version to ${{ steps.get_version.outputs.version }}"
|
|
58
|
+
|
|
59
|
+
- name: Push branch
|
|
60
|
+
run: git push origin release-version-${{ steps.get_version.outputs.version }}
|
|
61
|
+
|
|
62
|
+
- name: Create pull request
|
|
63
|
+
run: |
|
|
64
|
+
gh pr create \
|
|
65
|
+
--base main \
|
|
66
|
+
--head release-version-${{ steps.get_version.outputs.version }} \
|
|
67
|
+
--title "Release version ${{ steps.get_version.outputs.version }}" \
|
|
68
|
+
--body "Bumps version to ${{ steps.get_version.outputs.version }} (${{ github.event.inputs.bump }} bump)."
|
|
69
|
+
env:
|
|
70
|
+
GH_TOKEN: ${{ secrets.GH_ACTIONS_TOKEN }}
|
|
71
|
+
|
|
72
|
+
- name: Enable automerge
|
|
73
|
+
run: gh pr merge --auto --squash release-version-${{ steps.get_version.outputs.version }}
|
|
74
|
+
env:
|
|
75
|
+
GH_TOKEN: ${{ secrets.GH_ACTIONS_TOKEN }}
|