Description¶
Downloads all attachments from a Jira issue and saves them with their original filenames to a specified directory. Supports filtering by filename pattern and list-only mode for previewing attachments. Designed for downloading manuscript PDFs and submission forms from AEA Data Editor Jira tickets.
Usage¶
python3 tools/jira_download_attachments.py <issue-key> [OPTIONS]Arguments¶
issue-key (required) - Jira issue key (e.g., AEAREP-9354, aearep-9354, case-insensitive)
Options¶
--output-dir DIR,-o DIR- Directory to save attachments (default: current directory)--filter PATTERN,-f PATTERN- Only download files matching this pattern (case-insensitive substring match)--list,-l- List attachments without downloading--verbose,-v- Print detailed progress information
Examples¶
# Download all attachments to current directory
python3 tools/jira_download_attachments.py AEAREP-9354
# Download to specific directory
python3 tools/jira_download_attachments.py AEAREP-9354 --output-dir ./attachments
# Download only PDF files
python3 tools/jira_download_attachments.py AEAREP-9354 --filter ".pdf"
# Download only manuscripts
python3 tools/jira_download_attachments.py AEAREP-9354 --filter "manuscript"
# Download only forms
python3 tools/jira_download_attachments.py AEAREP-9354 --filter "form"
# List attachments without downloading
python3 tools/jira_download_attachments.py AEAREP-9354 --list
# Verbose mode
python3 tools/jira_download_attachments.py AEAREP-9354 --verboseAutomation Script¶
A convenient wrapper script is available that automatically reads the Jira ticket from config.yml:
# Download all attachments from ticket in config.yml
bash automations/30_download_commit_jira_attachments.sh
# List attachments first
bash automations/30_download_commit_jira_attachments.sh --list
# Download only manuscripts
bash automations/30_download_commit_jira_attachments.sh --filter manuscript
# Download only forms
bash automations/30_download_commit_jira_attachments.sh --filter formRequirements¶
Python >= 3.6
jira: Python Jira library (already in requirements.txt)
Environment Variables Required¶
JIRA_USERNAME- Your Jira email addressJIRA_API_KEY- API token from https://id .atlassian .com /manage -profile /security /api -tokens
To obtain a Jira API token:
Visit https://
id .atlassian .com /manage -profile /security /api -tokens Click “Create API token”
Copy the token and set it as
JIRA_API_KEYenvironment variable
Output¶
On success: Downloads attachments with their original filenames; prints each filename to stdout
No attachments: Prints warning to stderr and exits with code 0
Missing credentials: Prints error message with instructions and exits with code 1
Invalid issue key: Prints error and exits with code 1
Download failure: Prints error for failed files but continues with remaining files
Typical Workflow¶
For AEA replication packages, each Jira ticket typically has two attachments:
A manuscript (PDF)
A submission form (PDF or Word document)
Recommended workflow:
# 1. Check what attachments are available
bash automations/30_download_commit_jira_attachments.sh --list
# 2. Download all attachments to repository root
bash automations/30_download_commit_jira_attachments.shOr download selectively:
# Download manuscript only
bash automations/30_download_commit_jira_attachments.sh --filter manuscript
# Download form only
bash automations/30_download_commit_jira_attachments.sh --filter formBehavior¶
Attachments are saved with their original filenames from Jira
Existing files with the same name will be overwritten without warning
Downloads are performed over HTTPS using the Jira REST API
The tool respects Jira API rate limits
Requires active internet connection and valid Jira credentials
See Also¶
jira_get_info.py - Retrieve Jira issue information
jira_add_comment.py - Post comments to Jira issues
jira_find_task_by_icpsr.py - Find Jira tasks by openICPSR ID
30_download_commit_jira_attachments.sh - Automation wrapper script (downloads attachments and commits them)