A powerful GitHub CLI extension that streamlines the process of creating GitHub Pull Requests directly from Jira tickets. This extension automates the entire workflow from ticket information extraction to PR creation, making development workflows more efficient and consistent.
- π« Jira Integration: Automatically fetches ticket information including title, description, and team details
- πΏ Branch Management: Creates appropriately named feature branches based on ticket information
- π Smart PR Creation: Generates well-formatted Pull Requests with proper titles and descriptions
- β‘ Workflow Automation: Handles git operations including branch creation, commits, and pushes
- π·οΈ Team Detection: Automatically detects and includes team information in PR titles
- π Cross-linking: Links PRs back to their corresponding Jira tickets
Before using this extension, make sure you have:
- GitHub CLI (v2.0.0 or higher) - Install here
- GitHub CLI authenticated - Run
gh auth loginif not already done - Node.js (v16 or higher) - Required for the extension runtime
- Git configured with your credentials
- Jira API access with appropriate permissions
- A repository with a
developbranch (default base branch for PRs)
# Verify GitHub CLI is installed and authenticated
gh --version
gh auth status
# Verify Git is configured
git config --global user.name
git config --global user.email
# Verify Node.js version
node --version- GitHub CLI (
gh) installed and authenticated - Node.js 18 or higher (required for native fetch support)
- Access to Jira REST API with appropriate permissions
# Install the extension directly from GitHub
gh extension install lansisDev/gh-createprThat's it! The extension is now available as gh createpr.
# Check if the extension is installed
gh extension list
# Test the extension
gh createpr --helpBefore installing, ensure you have:
-
GitHub CLI installed: Download here or install via:
# macOS brew install gh # Windows winget install --id GitHub.cli # Linux (Ubuntu/Debian) sudo apt install gh
-
GitHub CLI authenticated:
gh auth login
If you want to contribute or modify the extension:
# Clone the repository
git clone https://github.com/lansisDev/gh-createpr.git
cd gh-createpr
# Install dependencies
npm install
# Build the project
npm run build
# Install as local GitHub CLI extension
gh extension install .If you encounter issues:
# Uninstall and reinstall
gh extension remove createpr
gh extension install lansisDev/gh-createpr
# Check GitHub CLI version (requires v2.0.0+)
gh --version
# Verify GitHub CLI authentication
gh auth status-
Install the extension:
gh extension install lansisDev/gh-createpr
-
Set up Jira credentials (see Configuration section below):
export JIRA_BASE_URL="https://your-company.atlassian.net" export JIRA_EMAIL="your-email@company.com" export JIRA_API_TOKEN="your-jira-api-token"
-
Navigate to your git repository and run:
gh createpr LAN-123
That's it! The extension will create a branch, commit, and pull request automatically.
The extension requires these Jira credentials to fetch ticket information:
export JIRA_BASE_URL="https://your-company.atlassian.net"
export JIRA_EMAIL="your-email@company.com"
export JIRA_API_TOKEN="your-jira-api-token"- Go to Atlassian Account Settings
- Click "Create API token"
- Give it a descriptive name (e.g., "gh-createpr-extension")
- Copy the generated token (save it securely!)
- JIRA_BASE_URL: Your company's Jira URL (e.g.,
https://mycompany.atlassian.net) - JIRA_EMAIL: The email address associated with your Jira account
Option A: Temporary (current session only)
export JIRA_BASE_URL="https://your-company.atlassian.net"
export JIRA_EMAIL="your-email@company.com"
export JIRA_API_TOKEN="your-jira-api-token"Option B: Permanent (recommended)
Add to your shell profile file (~/.zshrc, ~/.bashrc, or ~/.bash_profile):
# GitHub CLI createpr extension - Jira Configuration
export JIRA_BASE_URL="https://your-company.atlassian.net"
export JIRA_EMAIL="your-email@company.com"
export JIRA_API_TOKEN="your-jira-api-token"Then reload your shell:
source ~/.zshrc # or ~/.bashrc# Test that environment variables are set
echo $JIRA_BASE_URL
echo $JIRA_EMAIL
echo $JIRA_API_TOKEN
# Test the extension with a real ticket
gh createpr YOUR-TICKET-123gh createpr <JIRA_TICKET># Create PR for ticket LAN-123
gh createpr LAN-123
# Create PR for ticket PROJ-456
gh createpr PROJ-456- Fetches Jira ticket data including title, description, and team information
- Switches to develop branch and pulls latest changes
- Creates a new feature branch with format:
{ticket-id}-{slugified-title} - Makes an initial commit with a conventional commit message
- Pushes the branch to the remote repository
- Creates a Pull Request with proper title and description linking back to Jira
π Fetching data for LAN-123 from Jira...
π Validating data obtained from Jira...
β
Title: Add user authentication feature
π Description: Implement OAuth2 authentication for user login
π₯ Team: Frontend
πΏ New branch: lan-123-add-user-authentication-feature
π Switching to develop and updating...
π§ Creating new branch: lan-123-add-user-authentication-feature
π Creating initial commit...
β¬οΈ Pushing branch to origin...
π Creating Pull Request from lan-123-add-user-authentication-feature to develop...
π Pull Request created from 'lan-123-add-user-authentication-feature' to 'develop'
β
You are now on branch 'lan-123-add-user-authentication-feature' with initial commit pushed
π The PR is ready on GitHubgh-createpr/
βββ src/
β βββ index.ts # Main CLI application
βββ dist/ # Compiled JavaScript output
βββ manifest.yml # GitHub CLI extension manifest
βββ package.json # Project configuration
βββ tsconfig.json # TypeScript configuration
βββ LICENSE # ISC License
βββ README.md # This file
# Build the project
npm run build
# Run in development mode
npm run dev
# Start the built version
npm start
# Prepare for publishing
npm run prepare# Clone and setup
git clone https://github.com/lansisDev/gh-createpr.git
cd gh-createpr
npm install
# Build
npm run build
# Test the extension locally
gh createpr LAN-123This GitHub CLI extension is built with:
- TypeScript for type safety and modern JavaScript features
- Commander.js for CLI argument parsing and command structure
- Node-fetch for HTTP requests to Jira API
- Node.js Child Process for Git operations
- GitHub CLI as the platform for the extension
- Jira API Integration: Fetches ticket data using REST API
- Git Operations: Automated branch management and commits
- GitHub CLI Integration: Leverages
gh pr createfor PR creation - Data Processing: Intelligent parsing of ticket information and team detection
Branches are automatically named using the format:
{ticket-id-lowercase}-{slugified-title}
Example: lan-123-add-user-authentication-feature
[{JIRA_TICKET}][{TEAM}] {TITLE}
Example: [LAN-123][Frontend] Add user authentication feature
feat({JIRA_TICKET}): initial commit for {TITLE}
Example: feat(LAN-123): initial commit for Add user authentication feature
The extension includes comprehensive error handling for:
- Missing environment variables
- Invalid Jira tickets
- Network connectivity issues
- Git operation failures
- GitHub CLI authentication problems
# List installed extensions
gh extension list
# Upgrade the extension
gh extension upgrade createpr
# Uninstall the extension
gh extension remove createprTo make the extension available for installation via gh extension install lansisDev/gh-createpr:
# Build the project
npm run build
# Make the binary executable
chmod +x dist/index.js# Create and push a tag
git tag v1.1.0
git push origin v1.1.0
# Create a GitHub release
gh release create v1.1.0 --title "v1.1.0" --notes "English translation release"Ensure manifest.yml has the correct tag version:
name: createpr
owner: lansisDev
host: github.com
tag: v1.1.0# Test the installation
gh extension install lansisDev/gh-createpr
# Verify it works
gh createpr --help- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the ISC License - see the LICENSE file for details.
Gonzalo Buasso
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information about your problem
- Include relevant error messages and environment details
- English Translation: Translated all Spanish text to English for international accessibility
- Improved User Interface: All console messages, error messages, and help text now in English
- Better Documentation: Example output updated to reflect English interface
- Enhanced Usability: More professional appearance for global developer community
- Initial release
- Jira integration for ticket data fetching
- Automated branch creation and PR generation
- Team detection and proper PR formatting
- Comprehensive error handling
Made with β€οΈ by lansisDev