@@ -163,7 +163,7 @@ def create_task(
163163 data: Custom task data.
164164 max_runtime: Maximum expected runtime (seconds).
165165 stale_timeout: Maximum allowed time between updates (seconds).
166- actions: Task actions.
166+ actions: Task actions. **Deprecated:** use project-level actions instead.
167167 monitor_id: ID of the monitor to associate this task with.
168168 tags: Dictionary of namespace -> value tags.
169169 queue: Name of the queue the task is from.
@@ -190,6 +190,7 @@ def create_task(
190190 data = data or {}
191191 task_dict ["data" ] = {** scope .context , ** data }
192192 if actions :
193+ _warn_actions_deprecated ()
193194 task_dict ["actions" ] = [a .to_dict () for a in actions ]
194195 if scope .tags or tags :
195196 tags = tags or {}
@@ -234,7 +235,7 @@ def update_task(
234235 data: Custom task data.
235236 max_runtime: Maximum expected runtime (seconds).
236237 stale_timeout: Maximum allowed time between updates (seconds).
237- actions: Task actions.
238+ actions: Task actions. **Deprecated:** use project-level actions instead.
238239 tags: Dictionary of namespace -> value tags.
239240 queue: Name of the queue the task is from.
240241
@@ -262,6 +263,7 @@ def update_task(
262263 queue = queue ,
263264 )
264265 if actions :
266+ _warn_actions_deprecated ()
265267 body .additional_properties = {"actions" : [a .to_dict () for a in actions ]}
266268 if tags :
267269 body .tags = PatchedTaskRequestTags .from_dict (tags )
@@ -281,6 +283,16 @@ def list_tasks(page_size: int = None, cursor: str = None):
281283 return response .parsed
282284
283285
286+ _ACTIONS_DEPRECATED_MESSAGE = (
287+ "Per-task actions are deprecated in favor of project-level actions and will be "
288+ "removed in a future release. See https://docs.taskbadger.net/actions/."
289+ )
290+
291+
292+ def _warn_actions_deprecated ():
293+ warnings .warn (_ACTIONS_DEPRECATED_MESSAGE , DeprecationWarning , stacklevel = 3 )
294+
295+
284296def _make_args (** kwargs ):
285297 settings = Badger .current .settings
286298 ret_args = settings .as_kwargs ()
@@ -457,7 +469,11 @@ def update(
457469 self ._task = task ._task
458470
459471 def add_actions (self , actions : list [Action ]):
460- """Add actions to the task."""
472+ """Add actions to the task.
473+
474+ **Deprecated:** per-task actions are deprecated in favor of project-level
475+ actions and will be removed in a future release.
476+ """
461477 self .update (actions = actions )
462478
463479 def tag (self , tags : dict [str , str ]):
0 commit comments