Skip to content

Commit

Permalink
Set UID when setting Pagure PR flag
Browse files Browse the repository at this point in the history
Generate it from the check_name. This prevents creating
multiple separate flags (for each state). This was already introduced
in 0d4bc36 .
  • Loading branch information
lbarcziova committed Nov 29, 2024
1 parent bc265c4 commit 3e348a5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packit_service/worker/reporting/reporters/pagure.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT

import hashlib
import logging
from typing import Optional

Expand Down Expand Up @@ -47,8 +47,16 @@ def set_status(
url = CONTACTS_URL

if self.pull_request_object:
# generate a custom uid from the check_name,
# so that we can update flags we set previously,
# instead of creating new ones (Pagure specific behaviour)
uid = hashlib.sha256(check_name.encode()).hexdigest()
self.pull_request_object.set_flag(
username=check_name, comment=description, url=url, status=state_to_set
username=check_name,
comment=description,
url=url,
status=state_to_set,
uid=uid,
)

else:
Expand Down

0 comments on commit 3e348a5

Please sign in to comment.