GRM-27: fix: CI workflows for rootless runner compatibility
Post-merge Vikunja update / vikunja (push) Failing after 5s
CI / quality (push) Successful in 1m3s
CI / molecule-tests (0) (push) Failing after 3m35s
CI / molecule-tests (1) (push) Failing after 5m53s
CI / molecule-tests (2) (push) Failing after 5m59s

This commit was merged in pull request #6.
This commit is contained in:
2026-06-20 17:01:55 +00:00
parent ea18793963
commit 0fadb7c504
7 changed files with 125 additions and 17 deletions
+19 -4
View File
@@ -2,7 +2,7 @@
"""Auto-merge PR by extracting task ID from branch and validating PR title.
Usage:
REPO_TOKEN=<token> python3 scripts/auto_merge.py <branch> <pr_title> <repo> <pr_number>
REPO_TOKEN=<token> python3 scripts/auto_merge.py <branch> <pr_title> <repo> <pr_number> [label_name]
"""
import os
@@ -15,6 +15,8 @@ from gitea_runner_manager.config import CONVENTIONAL_RE, GITEA_API_URL, TASK_ID_
from gitea_runner_manager.exceptions import APIError
from gitea_runner_manager.i18n import _
READY_TO_MERGE = "ready-to-merge"
load_dotenv(override=True)
@@ -37,16 +39,31 @@ def validate_pr_title(pr_title: str) -> None:
)
def has_ready_to_merge_label(client: GiteaClient, pr_number: str) -> bool:
"""Check whether the PR has the ready-to-merge label via the API."""
labels = client.get_pr_labels(pr_number)
return any(label.get("name") == READY_TO_MERGE for label in labels)
@click.command()
@click.argument("branch")
@click.argument("pr_title")
@click.argument("repo")
@click.argument("pr_number")
def main(branch: str, pr_title: str, repo: str, pr_number: str) -> None:
@click.argument("label_name", required=False, default="")
def main(branch: str, pr_title: str, repo: str, pr_number: str, label_name: str) -> None:
token = os.environ.get("REPO_TOKEN", "")
if not token:
raise click.ClickException(_("ERROR: REPO_TOKEN is not set."))
owner, repo_name = repo.split("/")
client = GiteaClient(GITEA_API_URL, token, owner, repo_name)
# Gitea Actions may not populate github.event.label.name; fall back to API check.
if label_name != READY_TO_MERGE and not has_ready_to_merge_label(client, pr_number):
click.echo(_("Label '{label}' is not '{rtm}', skipping.", label=label_name, rtm=READY_TO_MERGE))
return
task_id = extract_task_id(branch)
if not task_id:
raise click.ClickException(
@@ -59,8 +76,6 @@ def main(branch: str, pr_title: str, repo: str, pr_number: str) -> None:
validate_pr_title(pr_title)
merge_title = f"{task_id}: {pr_title}"
owner, repo_name = repo.split("/")
client = GiteaClient(GITEA_API_URL, token, owner, repo_name)
try:
client.merge_pr(pr_number, merge_title)