Skip to content

dongdongbh/auto_sprint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Auto Sprint Transition

manage_sprint_transition.py automates your weekly Jira rhythm: it closes the current active sprint, creates (or reuses) the next sprint, moves any incomplete issues forward, and then starts the new sprint. Follow the guide below to configure and operate it safely.

1. Prerequisites

  • Python 3.12 (install with uv python install 3.12 if you do not already have it).
  • uv CLI for environment + dependency management.
  • Jira Software project backed by a Scrum board with at least one sprint defined.
  • Personal Jira API token: visit https://id.atlassian.com/manage-profile/security/api-tokens, click Create API token, name it, and copy the generated value. Store it securely—you can’t view it again later.

2. Environment Configuration

  1. From the project root, install dependencies and create the virtual environment in one step:
    uv sync
    The command reads pyproject.toml, ensures Python 3.12 is available, creates/updates .venv, and installs requests.
  2. Export credentials (add these to your shell profile or secrets manager so uv run can pick them up):
    export JIRA_EMAIL="you@example.com"
    export JIRA_API_KEY="paste-your-api-token"
    # optional overrides:
    export JIRA_BOARD_ID="1"                 # board id from the URL .../boards/1
    export JIRA_PROJECT_KEY="SCRUM"          # defaults to SCRUM
    export SPRINT_DURATION_DAYS="7"          # defaults to one week
  3. Run a dry test (installs missing deps automatically if you skipped uv sync):
    uv run python manage_sprint_transition.py
    The script prints the detected active sprint, closes it (preserving start/end dates when present), creates the successor sprint if missing, moves any unfinished issues to that sprint, and finally starts the new sprint using the configured duration.

3. Scheduling With Cron

  1. Create a wrapper so cron exports your env vars and calls uv run. Example ~/bin/run_sprint_rotation.sh:
    #!/usr/bin/env bash
    cd /home/you/projects/auto_sprint
    export JIRA_EMAIL="you@example.com"
    export JIRA_API_KEY="paste-your-api-token"
    export JIRA_BOARD_ID="1"
    uv run python manage_sprint_transition.py >> /home/you/projects/auto_sprint/logs/sprint_rotation.log 2>&1
    chmod +x the script and keep the API key in a secure location (for example a secrets manager).
  2. Add a cron entry (close every Tuesday at 11:55 PM):
    55 23 * * TUE /home/you/bin/run_sprint_rotation.sh
    
    Confirm with crontab -l. The log file helps you monitor successful runs.

4. Operational Tips

  • Rotate the API token if someone leaves the team.
  • Adjust SPRINT_DURATION_DAYS when your cadence changes.
  • If the script reports “No active sprint detected,” manually start Sprint 1 in Jira and re-run it—automation assumes exactly one active sprint exists.
  • Keep the repository up to date so fixes (for example board discovery tweaks) make it into your cron job.
  • Ensure the integration user has the “Manage Sprints” permission so moving issues and starting sprints succeeds.

About

auto_sprint

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages