Skip to content

JIRA Transition Tickets

Source: actions/jira-transition-tickets/action.yml

Finds and transitions JIRA tickets based on branch names.

Usage

- uses: futuredapp/.github/.github/actions/jira-transition-tickets@2.2.0
  with:
    jira_context: '...'
    transition: '...'
    merged_branches: '...'

Inputs

Name Type Required Default Description
jira_context string Yes A base64-encoded string of Jira context object. See README for required structure.
transition string Yes The name of the transition to transition the JIRA tickets.
merged_branches string Yes A comma-separated string of merged branch names.

Additional Details

jira_context (required)

A base64-encoded JSON string containing JIRA authentication credentials and configuration.

Structure:

{
  "cloud_id": "your-cloud-id",
  "user_email": "your-bot@serviceaccount.atlassian.com",
  "api_token": "YourJiraApiToken"
}

How to obtain Cloud ID:

Navigate to https://.atlassian.net/_edge/tenant_info

How to encode:

echo -n '{"cloud_id":"your-cloud-id","user_email":"bot@example.com","api_token":"token"}' | base64

GitHub Secrets: Store the base64-encoded string in a GitHub secret (e.g., JIRA_CONTEXT) for secure usage.

transition (required)

The name of the JIRA transition to execute. This must match the exact transition name in your JIRA workflow.

Examples: "Done", "In QA", "Ready for Testing", "Closed"

merged_branches (required)

A comma-separated string of branch names from which to extract JIRA ticket keys.

The action extracts keys matching the pattern [A-Z]+-[0-9]+ from each branch name.

Example: "feature/ABC-123-login,bugfix/XYZ-456-fix-crash"

How It Works

  1. Extract JIRA Keys: Parses branch names to extract ticket keys (e.g., ABC-123)
  2. Get Available Transitions: For each issue key, fetches available transitions from JIRA API
  3. Find Target Transition: Matches the target status name to find the corresponding transition ID
  4. Perform Transition: Executes the transition for each issue to move it to the target status

Usage Examples

Example 1: Transition tickets from merged branches

- name: Transition JIRA tickets
  uses: futuredapp/.github/.github/actions/jira-transition-tickets@main
  with:
    jira_context: ${{ secrets.JIRA_CONTEXT }}
    transition: "Ready for Testing"
    merged_branches: "feature/PROJ-123-new-feature,bugfix/PROJ-456-bug-fix"

Example 2: Transition tickets from dynamic branch list

- name: Transition tickets
  uses: futuredapp/.github/.github/actions/jira-transition-tickets@main
  with:
    jira_context: ${{ secrets.JIRA_CONTEXT }}
    transition: "Ready for Testing"
    merged_branches: ${{ steps.get_branches.outputs.branches }}

Example 3: In a reusable workflow

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Build app
        run: ./build.sh

      - name: Transition JIRA tickets on success
        if: success()
        uses: futuredapp/.github/.github/actions/jira-transition-tickets@main
        with:
          jira_context: ${{ secrets.JIRA_CONTEXT }}
          transition: "Ready for Testing"
          merged_branches: ${{ github.head_ref }}