Skip to content

feat(#295): add task preconditions for conditional execution#360

Open
johnjansen wants to merge 1 commit intomainfrom
feat/295-task-preconditions
Open

feat(#295): add task preconditions for conditional execution#360
johnjansen wants to merge 1 commit intomainfrom
feat/295-task-preconditions

Conversation

@johnjansen
Copy link
Owner

Summary

  • Added support for task preconditions that allow users to specify conditions under which tasks should execute
  • Implemented precondition conditions including day_of_week, time_range, env_set, and expr
  • Both pre_check and precondition conditions must pass for a task to run
  • Clear skip reasons are logged when preconditions fail

Test plan

  • Verify build passes
  • Verify tests pass
  • Test precondition evaluation with sample tasks
  • Verify backward compatibility with existing tasks

🤖 Generated with Claude Code

Added support for task preconditions that allow users to specify conditions
under which tasks should execute. Precondition conditions include:

- day_of_week: restrict execution to specific days (e.g., "1-5" for weekdays)
- time_range: restrict execution to specific time ranges (e.g., "09:00-17:00")
- env_set: require specific environment variables to be set
- expr: complex expressions using Go template syntax

Both pre_check and precondition conditions must pass for a task to run.
If any precondition fails, the task is skipped with a clear skip reason.

Example usage:
---
schedule: "0 9 * * *"
precondition:
  day_of_week: "1-5"      # only weekdays
  time_range: "09:00-17:00"  # only business hours
  env_set: "CI"            # only when CI env var is set
---

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant