DEVX-31: fix: prefer branch name for task ID extraction + strip heads/ prefix in release
Post-merge / detect-type (push) Successful in 8s
Post-merge / validate-commit-msg (push) Successful in 14s
Post-merge / configure-repo (push) Successful in 13s
Post-merge / release (push) Failing after 29s
Post-merge / sync-wiki (push) Has been skipped
Post-merge / vikunja (push) Has been skipped
Post-merge / badges (push) Successful in 37s

This commit was merged in pull request #48.
This commit is contained in:
2026-06-24 10:54:58 +00:00
parent 6631525a1d
commit 8e9681cf7d
3 changed files with 19 additions and 8 deletions
+9 -7
View File
@@ -63,20 +63,22 @@ def run_cmd(args: list[str], check: bool = True) -> subprocess.CompletedProcess[
def read_taskid(branch: str) -> str:
"""Read task ID from .taskid file, falling back to branch name extraction.
"""Read task ID from branch name, falling back to .taskid file.
The .taskid file is a simple text file containing just the task ID
(e.g., ``DEVX-60``). If the file doesn't exist, extract from the
branch name as a backwards-compatibility fallback.
The branch name is the primary source of truth for the task ID
(e.g., ``DEVX-31-fix-foo`` → ``DEVX-31``). The ``.taskid`` file
is a legacy fallback for branches without a task ID prefix.
"""
branch_task_id = extract_task_id(branch)
if branch_task_id:
return branch_task_id
# Fallback: read from .taskid file
path = Path(TASKID_FILE)
if path.exists():
task_id = path.read_text(encoding="utf-8").strip()
if task_id:
return task_id
# Fallback: extract from branch name
match = TASK_ID_RE.search(branch)
return match.group(0) if match else ""
return ""
def extract_task_id(branch: str) -> str:
+2
View File
@@ -547,6 +547,8 @@ def main(dry_run: bool, skip_tests: bool, verify: bool) -> None:
# Ensure we're on master (skip this check in dry-run mode for PR validation)
branch = run_cmd(["git", "rev-parse", "--abbrev-ref", "HEAD"]).stdout.strip()
# Some git versions return "heads/master" instead of "master"
branch = branch.removeprefix("heads/")
if branch != "master" and not dry_run:
raise click.ClickException(_("Release must be run on master, currently on '{branch}'.", branch=branch))
if branch != "master" and dry_run: