Skip to content

Commit 28555bd

Browse files
committed
ci: update PR format
1 parent 3673686 commit 28555bd

File tree

3 files changed

+13
-22
lines changed

3 files changed

+13
-22
lines changed

.github/scripts/version_bump.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,26 @@
33

44
import argparse
55
import sys
6-
from datetime import datetime, timezone
76
from pathlib import Path
87

98
SCRIPT_DIR = Path(__file__).resolve().parent
109
if str(SCRIPT_DIR) not in sys.path:
1110
sys.path.insert(0, str(SCRIPT_DIR))
1211

1312
from version_common import ( # noqa: E402
14-
REPO_ROOT,
1513
VersionUpdateError,
1614
get_current_version,
1715
update_references,
1816
)
1917

20-
REPORT_PATH = REPO_ROOT / ".github" / "version-bump-report.md"
2118

22-
23-
def build_report(role: str, current: str, new: str) -> None:
19+
def build_report(role: str, current: str, new: str, repo: str) -> None:
2420
lines = [
25-
"## Version Update Report",
26-
"",
27-
f"Run at: {datetime.now(timezone.utc).strftime('%Y-%m-%d %H:%M:%S %Z')}",
28-
"",
29-
f"- `{role}`: `{current}` → `{new}`",
21+
f"The upstream [{role}]({repo}): `{current}` → `{new}`!",
3022
"",
23+
"This automated PR updates code to bring new version into repository."
3124
]
32-
REPORT_PATH.write_text("\n".join(lines), encoding="utf-8")
25+
Path(f"/tmp/version-bump-report-{role}-{new}.md").write_text("\n".join(lines), encoding="utf-8")
3326

3427

3528
def main() -> int:
@@ -38,18 +31,20 @@ def main() -> int:
3831
)
3932
parser.add_argument("--role", required=True, help="Role name to update")
4033
parser.add_argument("--new-version", required=True, help="New version to set")
34+
parser.add_argument("--repo", required=True, help="Repository URL")
4135
args = parser.parse_args()
4236

4337
role = args.role
4438
new_version = args.new_version
39+
repo = args.repo
4540

4641
current_version = get_current_version(role)
4742
if current_version == new_version:
4843
print(f"::notice::{role} already at requested version {new_version}")
4944
return 0
5045

5146
update_references(role, new_version)
52-
build_report(role, current_version, new_version)
47+
build_report(role, current_version, new_version, repo)
5348
print(f"::notice::Updated {role} from {current_version} to {new_version}")
5449
return 0
5550

.github/scripts/version_common.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,7 @@ def normalize_repo_reference(raw: str) -> Tuple[str, str]:
7979
remainder = remainder[:-4]
8080
if not host_part or not remainder:
8181
raise VersionUpdateError(f"Invalid repository reference '{raw}'")
82-
83-
host_map = {
84-
"github.com": "github",
85-
}
86-
host = host_map.get(host_part, host_part)
87-
return host, remainder
82+
return host_part, remainder
8883

8984

9085
def load_role_metadata() -> List[RoleMetadata]:
@@ -154,7 +149,7 @@ def fetch_latest_github_release(repo: str, token: str) -> Optional[str]:
154149

155150

156151
def discover_latest_version(role_meta: RoleMetadata, token: str) -> Optional[str]:
157-
if role_meta.host == "github":
152+
if role_meta.host == "github.com":
158153
return fetch_latest_github_release(role_meta.repo_path, token)
159154
print(
160155
f"::warning::Unsupported githost '{role_meta.host}' for role {role_meta.name}",

.github/workflows/version_bumper.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ jobs:
5656
env:
5757
ROLE_NAME: ${{ matrix.role }}
5858
NEW_VERSION: ${{ matrix.new_version }}
59-
run: python .github/scripts/version_bump.py --role "${ROLE_NAME}" --new-version "${NEW_VERSION}"
59+
REPO: https://${{ matrix.host }}/${{ matrix.repo_path }}
60+
run: python .github/scripts/version_bump.py --role "${ROLE_NAME}" --new-version "${NEW_VERSION} --repo "${REPO}"
6061

6162
- name: Check git status
6263
id: git_state
@@ -75,8 +76,8 @@ jobs:
7576
branch: autoupdate/${{ matrix.role }}/${{ matrix.new_version }}
7677
delete-branch: true
7778
commit-message: "chore(${{ matrix.role }}): bump to ${{ matrix.new_version }}"
78-
title: "chore(${{ matrix.role }}): bump to ${{ matrix.new_version }}"
79-
body-path: .github/version-bump-report.md
79+
title: "patch(${{ matrix.role }}): bump to ${{ matrix.new_version }}"
80+
body-path: /tmp/version-bump-report-${{ matrix.role }}-${{ matrix.new_version }}.md
8081

8182
- name: No changes
8283
if: steps.git_state.outputs.changed != 'true'

0 commit comments

Comments
 (0)