Skip to content
Merged

Dev #48

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions .github/workflows/ci-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,25 @@ jobs:
raw = resp.read()
return json.loads(raw) if raw else None

# Delete any pre-existing release branch (from a prior partial run)
# so the bump always starts from main's HEAD. Avoids STALE_DATA from
# createCommitOnBranch and prevents stacking multiple bump commits.
# Any open PR on the stale branch gets auto-closed when the branch
# is deleted, which is fine — we always open a fresh PR below.
try:
api(
f"repos/{repo}/git/refs",
method="POST",
body={"ref": f"refs/heads/{branch}", "sha": head_oid},
)
api(f"repos/{repo}/git/refs/heads/{branch}", method="DELETE")
print(f"deleted stale branch: {branch}")
except urllib.error.HTTPError as error:
if error.code != 422: # 422 = ref already exists; OK to reuse
if error.code not in (404, 422): # ref doesn't exist; nothing to clean
raise

api(
f"repos/{repo}/git/refs",
method="POST",
body={"ref": f"refs/heads/{branch}", "sha": head_oid},
)
expected_oid = head_oid

def b64(path: str) -> str:
with open(path, "rb") as fp:
return base64.b64encode(fp.read()).decode("ascii")
Expand All @@ -173,7 +182,7 @@ jobs:
"message": {
"headline": f"Bump version to v{version} [skip ci]",
},
"expectedHeadOid": head_oid,
"expectedHeadOid": expected_oid,
"fileChanges": {
"additions": [
{"path": "stable.toml", "contents": b64("stable.toml")},
Expand Down
Loading