This GitHub Action automatically formats pull requests with JIRA ticket information. When a PR is opened, it:
- Assigns the PR to the author
- Adds JIRA ticket prefix to the title (extracted from branch name)
- Links the JIRA ticket in the PR description
github-token: GitHub token for API access. Required. Default:${{ github.token }}jira-base-url: JIRA base URL (e.g., https://enosix.atlassian.net). Optional. Default:https://enosix.atlassian.netticket-prefix: JIRA ticket prefix (e.g., PROD). Optional. Default:PRODstory-needed-label: Label to use when no ticket found. Optional. Default:[STORY NEEDED]pr-number: PR number to process. Optional. Default: auto-detected from PR context
The action extracts the JIRA ticket number from the branch name and:
-
If a ticket is found (e.g., branch
PROD-1234-feature):- Updates title to:
[PROD-1234] Original Title - Adds JIRA link to description:
https://enosix.atlassian.net/browse/PROD-1234
- Updates title to:
-
If no ticket is found:
- Updates title to:
[STORY NEEDED] Original Title
- Updates title to:
The action skips updates if the PR title already has a ticket prefix or [STORY NEEDED] label.
Important: This action must be triggered on pull_request with types: [opened] to work correctly.
name: PR Automation
on:
pull_request:
types: [opened, reopened]
permissions:
contents: read
pull-requests: write
jobs:
format-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Format PR
uses: enosix/ghac-format-pr@stable
with:
github-token: ${{ secrets.GITHUB_TOKEN }}name: JIRA PR Automation
on:
pull_request:
types: [opened, reopened]
permissions:
pull-requests: write
contents: read
jobs:
jira-automation:
runs-on: ubuntu-latest
steps:
- name: Auto-format PR with JIRA ticket
uses: enosix/ghac-format-pr@stable
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
jira-base-url: 'https://yourcompany.atlassian.net'
ticket-prefix: 'PROJ'
story-needed-label: '[NO TICKET]'Before:
- Title:
Add new feature - Body:
This adds a new feature for users
After:
- Title:
[PROD-1234] Add new feature - Body:
This adds a new feature for users --- https://enosix.atlassian.net/browse/PROD-1234
Before:
- Title:
Add new feature
After:
- Title:
[STORY NEEDED] Add new feature