From b0e282a36769c1e8936bc269734acf440c392edb Mon Sep 17 00:00:00 2001 From: Michal Konečný Date: Feb 24 2021 10:50:51 +0000 Subject: Use pagure commit flag API Instead of flagging the whole PR, flag only tested commit. Signed-off-by: Michal Konečný --- diff --git a/toddlers/plugins/flag_ci_pr.py b/toddlers/plugins/flag_ci_pr.py index 8754819..fd1d439 100644 --- a/toddlers/plugins/flag_ci_pr.py +++ b/toddlers/plugins/flag_ci_pr.py @@ -143,7 +143,8 @@ class FlagCIPR(ToddlerBase): pr_id = str(msg["artifact"]["id"]) - commit_hash_text = " for %s" % msg["artifact"]["commit_hash"][:8] + commit_hash = msg["artifact"]["commit_hash"] + commit_hash_text = " for %s" % commit_hash[:8] seed = config.get("dist_git_token_seed", config.get("pagure_token_seed")) or "" data = { @@ -161,9 +162,7 @@ class FlagCIPR(ToddlerBase): namespace = msg["artifact"]["repository"].split("/")[-2] repo = msg["artifact"]["repository"].split("/")[-1] - target_url = "/".join( - ["api", "0", namespace, repo, "pull-request", pr_id, "flag"] - ) + target_url = "/".join(["api", "0", namespace, repo, "c", commit_hash, "flag"]) flag_url = dist_git_url + "/" + target_url _log.info("Flagging commit at: %s" % flag_url)