Skip to content

Commit 1df9cdb

Browse files
committed
Take prefixes related to staging instances to consideration
1 parent dc92519 commit 1df9cdb

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

packit_service/worker/jobs.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,24 @@ def is_fas_verification_comment(self, comment: str) -> bool:
11281128

11291129
return bool(command and command[0] == PACKIT_VERIFY_FAS_COMMAND)
11301130

1131+
def retieve_comment_command_prefix(self, comment: str) -> Optional[str]:
1132+
"""
1133+
Retrieves the Packit prefix used in comment.
1134+
1135+
Args:
1136+
comment: Comment to retrieve prefix from.
1137+
1138+
Returns:
1139+
Packit comment command prefix or None if none is found.
1140+
"""
1141+
prefixes = ["/packit-ci-stg", "/packit-ci", "/packit-stg", "/packit"]
1142+
1143+
for prefix in prefixes:
1144+
if comment.startswith(prefix):
1145+
return prefix
1146+
1147+
return None
1148+
11311149
def is_help_comment(self, comment: str) -> bool:
11321150
"""
11331151
Checks whether the comment contains Packit help command:
@@ -1139,9 +1157,8 @@ def is_help_comment(self, comment: str) -> bool:
11391157
Returns:
11401158
`True`, if is help comment, `False` otherwise.
11411159
"""
1142-
packit_comment_command_prefix = (
1143-
"/packit-ci" if comment.startswith("/packit-ci") else "/packit"
1144-
)
1160+
if not (packit_comment_command_prefix := self.retieve_comment_command_prefix(comment)):
1161+
return False
11451162

11461163
command = get_packit_commands_from_comment(
11471164
comment,

0 commit comments

Comments
 (0)