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.
- Python 3.12 (install with
uv python install 3.12if you do not already have it). uvCLI 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.
- From the project root, install dependencies and create the virtual environment in one step:
The command reads
uv sync
pyproject.toml, ensures Python 3.12 is available, creates/updates.venv, and installsrequests. - Export credentials (add these to your shell profile or secrets manager so
uv runcan 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
- Run a dry test (installs missing deps automatically if you skipped
uv sync):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.uv run python manage_sprint_transition.py
- 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 +xthe script and keep the API key in a secure location (for example a secrets manager). - Add a cron entry (close every Tuesday at 11:55 PM):
Confirm with
55 23 * * TUE /home/you/bin/run_sprint_rotation.shcrontab -l. The log file helps you monitor successful runs.
- Rotate the API token if someone leaves the team.
- Adjust
SPRINT_DURATION_DAYSwhen 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.