GRM-54: fix: fix broken automation pipeline (auto-merge, Vikunja, CI enforcement)

This commit is contained in:
2026-06-22 08:04:54 +00:00
parent ad3c43bf8e
commit 0bf78d4f83
8 changed files with 97 additions and 9 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ from gitea_runner_manager.exceptions import APIError
from gitea_runner_manager.i18n import _
READY_TO_MERGE = "ready-to-merge"
MAX_WAIT_SECONDS = 180 # 3 minutes max — CI should already be running
MAX_WAIT_SECONDS = 600 # 10 minutes max — CI may still be running when label is added
POLL_INTERVAL_SECONDS = 15 # Poll every 15 seconds
+23 -3
View File
@@ -99,13 +99,33 @@ def build_comment(task_id: str, conv_msg: str, commit_sha: str) -> str:
@click.argument("commit_msg", required=False)
@click.option("--commit-sha", default="", help="Commit SHA")
@click.option("--from-git", is_flag=True, default=False, help="Read commit message and SHA from git.")
def main(commit_msg: str | None, commit_sha: str, from_git: bool) -> None:
if from_git:
@click.option(
"--git-sha",
default="",
help="Read commit message from a specific git SHA (avoids race condition with parallel jobs).",
)
def main(commit_msg: str | None, commit_sha: str, from_git: bool, git_sha: str) -> None:
if git_sha:
# Read commit message from a specific SHA — this avoids the race
# condition where a parallel job (e.g., release) pushes a new commit
# to master before this job reads HEAD.
result = subprocess.run( # nosec B603 B607
["git", "log", "-1", "--pretty=%B", git_sha],
capture_output=True,
text=True,
check=False,
)
if result.returncode != 0:
raise click.ClickException(f"git log failed for SHA {git_sha}: {result.stderr.strip()}")
commit_msg = result.stdout.strip()
if not commit_sha:
commit_sha = git_sha
elif from_git:
commit_msg = _get_git_commit_message()
if not commit_sha:
commit_sha = _get_git_commit_sha()
if not commit_msg:
raise click.ClickException("commit_msg argument is required (or use --from-git)")
raise click.ClickException("commit_msg argument is required (or use --from-git or --git-sha)")
token = os.environ.get("VIKUNJA_TOKEN", "")
if not token:
raise click.ClickException(_("ERROR: VIKUNJA_TOKEN is not set."))