Skip to content

itsandreramon/jirascrape

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jira Ticket Scraper

Scrapes Jira tickets assigned to you and saves each ticket to a separate file (XML by default).

Also supports changing ticket status via the Jira transitions API.

Setup

  1. Create a Python virtual environment and install dependencies:
python3 -m venv .venv
source .venv/bin/activate
pip install playwright
playwright install chromium
  1. Create a .env file with your Jira configuration:
JIRA_BASE_URL=https://jira.example.com
JIRA_BOARD_ID=12345  # Optional: Agile board ID for sprint operations
  1. Create a .jira_credentials.json file with your credentials:
{"username": "your.email@example.com", "password": "your-password"}

Usage

See all features and examples:

./scrape-jira.sh --help

Fetching Tickets

./scrape-jira.sh                          # Fetch 100 most recent tickets (XML)
./scrape-jira.sh -n 500                   # Fetch up to 500 tickets
./scrape-jira.sh --format txt             # Output as plain text instead of XML
./scrape-jira.sh --status "In Progress"   # Fetch only in-progress tickets
./scrape-jira.sh --status "Open"          # Fetch only open tickets
./scrape-jira.sh --active-sprint          # Fetch tickets in active sprint
./scrape-jira.sh --active-sprint --status "Open"  # Open tickets in active sprint
./scrape-jira.sh --login                  # Force new login (refresh session)

Changing Ticket Status

./scrape-jira.sh --change-status TICKET-123 --to-status "In Progress"
./scrape-jira.sh -c TICKET-123 -t "Done"

The script will:

  1. Fetch available transitions for the ticket
  2. Find the transition that leads to the target status
  3. Execute the transition

Note: Available transitions depend on the ticket's current status and your project's workflow.

Common Status Values

  • Open
  • In Progress
  • Ready for Review
  • In Review
  • Done
  • Closed

Note: Status values are case-sensitive and may vary by project.

Output

Tickets are organized into folders by their Jira status:

output/
├── blocked/
├── code_review/
├── completed/
├── in_progress/
├── ready_for_testing/
└── testing/

Each ticket is saved as an .xml file (or .txt with --format txt).

Options

Option Short Description
--format FORMAT -f Output format: xml (default) or txt
--max-results N -n Maximum tickets to fetch (default: 100)
--status STATUS -s Filter by ticket status
--active-sprint Filter by active sprint
--output DIR -o Output directory
--login -l Force new login
--headed Show browser window (for SSO login)

Files

  • jira_scraper.py - Main Python scraper using Playwright
  • scrape-jira.sh - Shell wrapper script
  • .env - Environment configuration (not tracked in git)
  • .jira_credentials.json - Your credentials (not tracked in git)
  • .jira_cookies.json - Saved session cookies (not tracked in git)
  • output/ - Ticket files (not tracked in git)

Environment Variables

Variable Required Description
JIRA_BASE_URL Yes Base URL of your Jira instance
JIRA_BOARD_ID No Agile board ID for sprint operations

About

Headless Chrome to fetch Jira tickets if PAT access is disallowed.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors