Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 

Repository files navigation

CloudBees action: Create Jira Issue

Create new Jira issues with specified fields using YAML format for issue data.

Inputs

Table 1. Input details
Input name Data type Required? Description

jira-url

String

Yes

Jira instance URL (e.g., https://your-domain.atlassian.net)

jira-username

String

Yes

Jira username or email address

jira-token

String

Yes

Jira API token

project-key

String

Yes

Project key where the issue will be created (e.g., MYPROJECT)

issue-type

String

Yes

Issue type name (e.g., Bug, Story, Task, Epic)

issue-fields

YAML Object

Yes

YAML object containing issue fields like summary, description, etc.

notify-users

Boolean

No

Whether to send notifications to users about the new issue. Default is true

dry-run

Boolean

No

If true, validates the issue data without creating it. Default is false

Outputs

Table 2. Output details
Output name Data type Description

issue-key

String

The key of the created issue (e.g., PROJ-123)

issue-id

String

The internal ID of the created issue

issue-url

String

The URL to view the created issue

Usage Examples

Create a Bug Report

- name: Create bug report
  uses: https://github.com/cloudbees-days/jira-create-issue@v1
  id: create-bug
  with:
    jira-url: ${{ vars.JIRA_URL }}
    jira-username: ${{ vars.JIRA_USERNAME }}
    jira-token: ${{ secrets.JIRA_TOKEN }}
    project-key: "PROJ"
    issue-type: "Bug"
    issue-fields: |
      summary: "Application crashes on startup"
      description: |
        Application crashes during initialization.

        **Build:** ${{ cloudbees.run_id }}
        **Commit:** ${{ cloudbees.scm.sha }}
      priority:
        name: "High"
      labels:
        - "bug"
        - "critical"

- name: Show created issue
  run: |
    echo "Created issue: ${{ steps.create-bug.outputs.issue-key }}"
    echo "URL: ${{ steps.create-bug.outputs.issue-url }}"

Create a Story with Custom Fields

- name: Create user story
  uses: https://github.com/cloudbees-days/jira-create-issue@v1
  with:
    jira-url: ${{ vars.JIRA_URL }}
    jira-username: ${{ vars.JIRA_USERNAME }}
    jira-token: ${{ secrets.JIRA_TOKEN }}
    project-key: "PROJ"
    issue-type: "Story"
    issue-fields: |
      summary: "As a user, I want to export data"
      description: |
        User story for data export functionality.

        **Acceptance Criteria:**
        - Export button available
        - CSV format supported
        - Download starts immediately
      assignee:
        accountId: "557058:f58131cb-b67d-43c7-b30d-6b58d40bd077"
      labels:
        - "feature"
        - "export"
      customfield_10001: "8"  # Story points

Setup

Authentication

  1. Go to [Atlassian Account Settings](https://id.atlassian.com/manage-profile/security/api-tokens)

  2. Create an API token

  3. Store as secrets/variables in CloudBees:

    • JIRA_URL: Your Jira instance URL

    • JIRA_USERNAME: Your email address

    • JIRA_TOKEN: Your API token (store as secret)

Issue Fields Format

Common field formats for the issue-fields YAML:

# Required
summary: "Issue title"

# Optional standard fields
description: "Issue description"
priority:
  name: "High"  # High, Medium, Low
assignee:
  accountId: "user-account-id"
labels:
  - "label1"
  - "label2"

# Custom fields (use field ID from Jira)
customfield_10001: "Text value"
customfield_10002: 42  # Number

Troubleshooting

Project/Issue Type Not Found: Verify the project key and issue type exist and you have access Field Validation Errors: Check required fields and field formats match your Jira configuration Permission Errors: Ensure your user can create issues in the specified project

License

This code is made available under the MIT license.

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors