@@ -145,18 +145,18 @@ def register_callback_action(
145145 def register_callback (cb ):
146146 assert isinstance (name , str ), "name must be a string"
147147 assert isinstance (order , int ), "order must be an integer"
148- assert callable (schema ) or is_json (schema ), (
149- " schema must be a JSON compatible object"
150- )
148+ assert callable (schema ) or is_json (
149+ schema
150+ ), "schema must be a JSON compatible object"
151151 assert isinstance (cb , FunctionType ), "callback must be a function"
152152 # Allow for json-e > 25 chars in the symbol.
153153 if "$" not in symbol :
154154 assert 1 <= len (symbol ) <= 25 , "symbol must be between 1 and 25 characters"
155155 assert isinstance (symbol , str ), "symbol must be a string"
156156
157- assert not mem ["registered" ], (
158- "register_callback_action must be used as decorator "
159- )
157+ assert not mem [
158+ "registered "
159+ ], "register_callback_action must be used as decorator"
160160 assert cb_name not in callbacks , f"callback name { cb_name } is not unique"
161161
162162 def action_builder (parameters , graph_config , decision_task_id ):
@@ -300,14 +300,12 @@ def sanity_check_task_scope(callback, parameters, graph_config):
300300 else :
301301 raise ValueError (f"No action with cb_name { callback } " )
302302
303- raw_url = parameters ["base_repository" ]
304- parsed_url = parse (raw_url )
303+ parsed_base_url = parse ( parameters ["base_repository" ])
304+ parsed_head_url = parse (parameters [ "head_repository" ] )
305305 action_scope = (
306- f"assume:{ parsed_url .taskcluster_role_prefix } :action:{ action .permission } "
307- )
308- pr_action_scope = (
309- f"assume:{ parsed_url .taskcluster_role_prefix } :pr-action:{ action .permission } "
306+ f"assume:{ parsed_head_url .taskcluster_role_prefix } :action:{ action .permission } "
310307 )
308+ pr_action_scope = f"assume:{ parsed_base_url .taskcluster_role_prefix } :pr-action:{ action .permission } "
311309
312310 # the scope should appear literally; no need for a satisfaction check. The use of
313311 # get_current_scopes here calls the auth service through the Taskcluster Proxy, giving
0 commit comments