GithubHelp home page GithubHelp logo

gajira-create's Introduction


⚠️ This repository isn’t maintained anymore.

Jira Create

Create new issue

Only supports Jira Cloud. Does not support Jira Server (hosted)

Usage

Note: this action requires Jira Login Action
- name: Create
  id: create
  uses: atlassian/gajira-create@v3
  with:
    project: GA
    issuetype: Build
    summary: Build completed for ${{ github.repository }}
    description: Compare branch
    fields: '{"customfield_10171": "test"}'

- name: Log created issue
  run: echo "Issue ${{ steps.create.outputs.issue }} was created"

Action Spec:

Environment variables

  • None

Inputs

  • project (required) - Key of the project
  • issuetype (required) - Type of the issue to be created. Example: 'Incident'
  • summary (required) - Issue summary
  • description - Issue description
  • fields - Additional fields in JSON format

Outputs

  • issue - Key of the newly created issue

Reads fields from config file at $HOME/jira/config.yml

  • project
  • issuetype
  • summary
  • description

Writes fields to config file at $HOME/jira/config.yml

  • issue - a key of a newly created issue

Writes fields to CLI config file at $HOME/.jira.d/config.yml

  • issue - a key of a newly created issue

gajira-create's People

Contributors

dependabot[bot] avatar drudzikatlassian avatar imjohnbo avatar jgurnani-atl avatar joshkay10 avatar mboudreau avatar rudzon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gajira-create's Issues

TypeError: Cannot read properties of undefined (reading 'length')

Dear team,

I am attempting to use the atlassian/gajira-create@v3 Github action to create a jira ticket as part of a workflow after a scan results in a failure in a previous step (scan-result). I am using the following code in the workflow:

- name: Log into Jira if result found
   id: jira-login
   if: always() && steps.scan-result.outcome == 'failure'
   uses: atlassian/gajira-login@v3
   env:
      JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
      JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
      JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}

# If Jira Login successful, Create Jira Ticket
- name: Create Jira ticket
   id: create
   if: always() && steps.jira-login.outcome == 'success'
   uses: atlassian/gajira-create@v3
   with:
      project: ATP
      issuetype: Task
      summary: Found result
      description: test

The login action seems to complete successfully, however the ticket creation throws the following error:

Log into Jira if result found
   Run atlassian/gajira-login@v3
   env:
      JIRA_BASE_URL: ***
      JIRA_USER_EMAIL: ***
      JIRA_API_TOKEN: ***
   Successfully logged in.

Create Jira ticket
   Run atlassian/gajira-create@v3
   TypeError: Cannot read properties of undefined (reading 'length')
      at module.exports.execute (/home/runner/work/_actions/atlassian/gajira-create/v3/webpack:/create/action.js:28:1)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
      at exec (/home/runner/work/_actions/atlassian/gajira-create/v3/dist/index.js:32538:20)

Can anyone help me identify what is causing this issue and if it can be resolved? I have read previous posts that people have been able to create tickets using the action and from reviewing my inputs, I do not see any issues that could cause this.

Drop down custom fields are not working on Jira Cloud

Drop down custom fields are not working on Jira Cloud

job configuration

    - name: Create
      id: create
      uses: atlassian/gajira-create@master
      if: env.CREATE_ISSUE == 'true'
      with:
        project: XXXX
        issuetype: Task
        summary: "[PR Created] ${{ github.event.pull_request.title }}"
        description: |
          **Created by:** ${{ github.actor }}
          **PR:** https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}
          **Description:** 
          ${{ github.event.pull_request.body }}
        fields: '{"customfield_10148": "DevOps", "customfield_10151": "Change request" , "customfield_10154": "True"}'

Field configuration for customfield_10154 as an example

"customfield_10154": {
    "required": false,
    "schema": {
        "type": "option",
        "custom": "com.atlassian.jira.plugin.system.customfieldtypes:select",
        "customId": 10154
    },
    "name": "Auto Created Issue",
    "key": "customfield_10154",
    "hasDefaultValue": true,
    "operations": [
        "set"
    ],
    "allowedValues": [
        {
            "self": "https://up42.atlassian.net/rest/api/2/customFieldOption/10232",
            "value": "False",
            "id": "10232"
        },
        {
            "self": "https://up42.atlassian.net/rest/api/2/customFieldOption/10233",
            "value": "True",
            "id": "10233"
        }
    ],
    "defaultValue": {
        "self": "https://up42.atlassian.net/rest/api/2/customFieldOption/10232",
        "value": "False",
        "id": "10232"
    }
},

Job error

originError: Error: Bad Request
       at /home/runner/work/_actions/atlassian/gajira-create/master/dist/index.js:1:57112
       at processTicksAndRejections (internal/process/task_queues.js:97:5)
       at async Jira.fetch (/home/runner/work/_actions/atlassian/gajira-create/master/dist/index.js:1:63273)
       at async e.exports.execute (/home/runner/work/_actions/atlassian/gajira-create/master/dist/index.js:1:186085)
       at async exec (/home/runner/work/_actions/atlassian/gajira-create/master/dist/index.js:1:7099),
   source: 'jira',
   jiraError: {
     customfield_10148: "Specify a valid 'id' or 'name' for Domain",
     customfield_10151: "Specify a valid 'id' or 'name' for Change type",
     customfield_10154: "Specify a valid 'id' or 'name' for Auto Created Issue"
   }
 }

Markdown not evaluated correctly

We're sending the PR description as the body of the description and Jira does not evaluate it correctly.
In the example you can see we send > for quote and '`' to create "coded" text. We also tried sending ### for heading but it got evaluated as nested list.

Created by: "<actor name>"
PR: https://github.com/<org>/<repo>/pull/<pr number>
Description: 
Pull Request
============
>  Tracked in JIRA 

*Scope of the PR*

Add GitHub workflow to auto create Jira issue in `SRE Requests` in the following conditions:

No XXXX issue is mentioned in the subject or description when the PR is created

The user is not part of the SRE Team 

This workflow is using the following Org level secrets:

`AUTO_JIRA_ISSUE_FROM_PR` for GitHub API requests

`JIRA_USER_EMAIL` and `JIRA_API_TOKEN` for Jira API requests 

How can we instruct Jira to evaluate the body as markdown?

Action code

- name: Create
      id: create
      uses: atlassian/gajira-create@master
      if: env.CREATE_ISSUE == 'true'
      with:
        project: <project ID>
        issuetype: Task
        summary: "[PR Created] ${{ github.event.pull_request.title }}"
        description: |
          *Created by:* ${{ needs.get_actor_teams.outputs.name }}
          *PR:* https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}
          *Description:* 
          ${{ github.event.pull_request.body }}

Create fix version if it doesn't exist

If you attempt to create an issue with a non-existent fix version, you'll get a 400 error. This is somewhat unexpected, since you can create fix versions coincident with issues via the UI.

I could open a PR to call project/{projectIdOrKey}/versions prior to creating an issue to check if the fix version exists, though that doesn't seem like the best solution since it's an extra network request when it seems like Jira could handle this internally.

Support for Atlassian Format Document

One of our requirements for our CI setup is to create a Jira ticket as part of the job with a specific formatted rich text in the ticket's description.

Currently, we archive this using the v3 API for creating issues and the Atlassian Format Document in the description property.

We have been trying to get the same result with the gajira-create but without any luck.

I have tried different action configurations, with multiline and single-line texts, single quotes and double quotes, escaping characters, and more combinations.
But the resulting Jira ticket description is always a plain JSON text.

      - name: Create Jira task
        id: create-jira-task
        uses: atlassian/[email protected]
        with:
          project: PROJ
          issuetype: Task
          fields: '{"priority": {"name": "Highest"}}'
          summary: TITLE
          description: "{ \"version\":1, \"type\":\"doc\", \"content\":[{\"type\":\"heading\",\"attrs\":{\"level\":1},\"content\":[{\"type\":\"text\", \"text\":\"Header\"}]}]}"
#         description: '{ "version":1, "type":"doc", "content":[{"type":"heading","attrs":{"level":1},"content":[{"type":"text", "text":"Header"}]}]}'

I have not found any examples or alternatives on the web.
Is it possible to do this?

Thank you!

`SyntaxError: Unexpected identifier` when issue title includes backticks

My issue title was

The error: `Cannot add property 0, object is not extensible` 

and the github action failed with the following error. The action workflow: https://github.com/hazelcast/github-jira-tool-action/blob/main/action.yml

Logs:

2022-03-21T13:02:41.3290932Z Requested labels: ubuntu-latest
2022-03-21T13:02:41.3290989Z Job defined at: hazelcast/hazelcast-nodejs-client/.github/workflows/jira.yml@refs/heads/master
2022-03-21T13:02:41.3291013Z Waiting for a runner to pick up this job...
2022-03-21T13:02:43.0715096Z Job is waiting for a hosted runner to come online.
2022-03-21T13:02:47.4926882Z Job is about to start running on the hosted runner: GitHub Actions 9 (hosted)
2022-03-21T13:02:51.5608716Z Current runner version: '2.288.1'
2022-03-21T13:02:51.5637011Z ##[group]Operating System
2022-03-21T13:02:51.5637566Z Ubuntu
2022-03-21T13:02:51.5637971Z 20.04.4
2022-03-21T13:02:51.5638278Z LTS
2022-03-21T13:02:51.5638595Z ##[endgroup]
2022-03-21T13:02:51.5638971Z ##[group]Virtual Environment
2022-03-21T13:02:51.5639408Z Environment: ubuntu-20.04
2022-03-21T13:02:51.5639775Z Version: 20220227.1
2022-03-21T13:02:51.5640345Z Included Software: https://github.com/actions/virtual-environments/blob/ubuntu20/20220227.1/images/linux/Ubuntu2004-Readme.md
2022-03-21T13:02:51.5641078Z Image Release: https://github.com/actions/virtual-environments/releases/tag/ubuntu20%2F20220227.1
2022-03-21T13:02:51.5641906Z ##[endgroup]
2022-03-21T13:02:51.5642300Z ##[group]Virtual Environment Provisioner
2022-03-21T13:02:51.5642657Z 1.0.0.0-main-20220307-1
2022-03-21T13:02:51.5643038Z ##[endgroup]
2022-03-21T13:02:51.5644125Z ##[group]GITHUB_TOKEN Permissions
2022-03-21T13:02:51.5644812Z Actions: write
2022-03-21T13:02:51.5645292Z Checks: write
2022-03-21T13:02:51.5645740Z Contents: write
2022-03-21T13:02:51.5646098Z Deployments: write
2022-03-21T13:02:51.5646470Z Discussions: write
2022-03-21T13:02:51.5646820Z Issues: write
2022-03-21T13:02:51.5647187Z Metadata: read
2022-03-21T13:02:51.5647540Z Packages: write
2022-03-21T13:02:51.5647947Z Pages: write
2022-03-21T13:02:51.5648244Z PullRequests: write
2022-03-21T13:02:51.5648641Z RepositoryProjects: write
2022-03-21T13:02:51.5649058Z SecurityEvents: write
2022-03-21T13:02:51.5649426Z Statuses: write
2022-03-21T13:02:51.5649782Z ##[endgroup]
2022-03-21T13:02:51.5653632Z Secret source: Actions
2022-03-21T13:02:51.5654269Z Prepare workflow directory
2022-03-21T13:02:51.6499946Z Prepare all required actions
2022-03-21T13:02:51.6688790Z Getting action download info
2022-03-21T13:02:51.9407589Z Download action repository 'hazelcast/github-jira-tool-action@v3' (SHA:b27e06f9994cf9d61018cb806751db43c98b8e10)
2022-03-21T13:02:52.5952908Z Getting action download info
2022-03-21T13:02:52.8182120Z Download action repository 'atlassian/[email protected]' (SHA:90a599561baaf8c05b080645ed73db7391c246ed)
2022-03-21T13:02:53.2349451Z Download action repository 'atlassian/[email protected]' (SHA:c0a9c69ac9d6aa063fed57201e55336ada860183)
2022-03-21T13:02:53.6881108Z Download action repository 'actions/[email protected]' (SHA:a3e7071a34d7e1f219a8a4de9a5e0a34d1ee1293)
2022-03-21T13:02:54.3648653Z ##[group]Run hazelcast/github-jira-tool-action@v3
2022-03-21T13:02:54.3649029Z with:
2022-03-21T13:02:54.3649683Z   JIRA_BASE_URL: ***
2022-03-21T13:02:54.3649982Z   JIRA_USER_EMAIL: ***
2022-03-21T13:02:54.3650282Z   JIRA_API_TOKEN: ***
2022-03-21T13:02:54.3650536Z   TARGET_JIRA_PROJECT: API
2022-03-21T13:02:54.3650793Z   JIRA_LABEL: Node.js
2022-03-21T13:02:54.3651027Z   ISSUE_TYPE: Bug
2022-03-21T13:02:54.3651264Z ##[endgroup]
2022-03-21T13:02:54.3893971Z ##[group]Run atlassian/[email protected]
2022-03-21T13:02:54.3894310Z env:
2022-03-21T13:02:54.3894788Z   JIRA_BASE_URL: ***
2022-03-21T13:02:54.3895075Z   JIRA_USER_EMAIL: ***
2022-03-21T13:02:54.3895388Z   JIRA_API_TOKEN: ***
2022-03-21T13:02:54.3895624Z ##[endgroup]
2022-03-21T13:02:55.2185956Z Logged in as: undefined
2022-03-21T13:02:55.2436760Z ##[group]Run atlassian/[email protected]
2022-03-21T13:02:55.2437070Z with:
2022-03-21T13:02:55.2437296Z   project: API
2022-03-21T13:02:55.2437521Z   issuetype: Bug
2022-03-21T13:02:55.2437901Z   summary: The error: `Cannot add property 0, object is not extensible` [GH#1256]

2022-03-21T13:02:55.2438438Z   description: {panel}
*Created By:* srknzl
[Github permalink|https://github.com/hazelcast/hazelcast-nodejs-client/issues/1256]
{panel}

2022-03-21T13:02:55.2438857Z   fields: {"labels": ["Node.js"]}
2022-03-21T13:02:55.2439105Z ##[endgroup]
2022-03-21T13:02:56.8276143Z Created issue: API-1283
2022-03-21T13:02:56.8277859Z Saving API-1283 to /home/runner/.jira.d/config.yml
2022-03-21T13:02:56.8278496Z Saving API-1283 to /home/runner/jira/config.yml
2022-03-21T13:02:56.8431600Z ##[group]Run actions/[email protected]
2022-03-21T13:02:56.8432035Z with:
2022-03-21T13:02:56.8432562Z   script: const newTitle = `The error: `Cannot add property 0, object is not extensible` [API-1283]`
github.issues.update({
  issue_number: context.issue.number,
  owner: context.repo.owner,
  repo: context.repo.repo,
  title: newTitle
})

2022-03-21T13:02:56.8433293Z   github-token: ***
2022-03-21T13:02:56.8433533Z   debug: false
2022-03-21T13:02:56.8433789Z   user-agent: actions/github-script
2022-03-21T13:02:56.8434066Z   result-encoding: json
2022-03-21T13:02:56.8434300Z ##[endgroup]
2022-03-21T13:02:56.9103121Z SyntaxError: Unexpected identifier
2022-03-21T13:02:56.9103984Z     at new AsyncFunction (<anonymous>)
2022-03-21T13:02:56.9105310Z     at callAsyncFunction (/home/runner/work/_actions/actions/github-script/v4.0.2/dist/index.js:2451:56)
2022-03-21T13:02:56.9106123Z     at main (/home/runner/work/_actions/actions/github-script/v4.0.2/dist/index.js:2505:26)
2022-03-21T13:02:56.9107464Z     at Module.272 (/home/runner/work/_actions/actions/github-script/v4.0.2/dist/index.js:2489:1)
2022-03-21T13:02:56.9134540Z ##[error]Unhandled error: SyntaxError: Unexpected identifier
2022-03-21T13:02:56.9147823Z     at __webpack_require__ (/home/runner/work/_actions/actions/github-script/v4.0.2/dist/index.js:24:31)
2022-03-21T13:02:56.9148446Z     at startup (/home/runner/work/_actions/actions/github-script/v4.0.2/dist/index.js:43:19)
2022-03-21T13:02:56.9148959Z     at /home/runner/work/_actions/actions/github-script/v4.0.2/dist/index.js:49:18
2022-03-21T13:02:56.9149521Z     at Object.<anonymous> (/home/runner/work/_actions/actions/github-script/v4.0.2/dist/index.js:52:10)
2022-03-21T13:02:56.9149929Z     at Module._compile (internal/modules/cjs/loader.js:999:30)
2022-03-21T13:02:56.9150313Z     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
2022-03-21T13:02:56.9313044Z Cleaning up orphan processes

Labels aren't applied successfully on created issues

In this example:

      - name: Create JIRA Issue
        id: create
        uses: atlassian/gajira-create@v3
        with:
          project: IL23
          issuetype: Task
          summary: CI Failure for ${{ github.repository }}
          description: Please see full details at https://github.com/${{ github.repository}}/actions/runs/${{ github.run_id }}
          fields: '{"labels": ["ExampleLabel"]}'

It creates the Task in JIRA for the correct project, but the label doesn't exist.

Support setting custom fields?

It would be really nice to be able to set custom fields on a ticket when creating them. At the moment I'm having to do a two-step workaround using the following code snippet:

           - name: Set JIRA Ticket Epic
              run: >
                  curl 
                  -u ${{ secrets.JIRA_USER_EMAIL }}:${{ secrets.JIRA_API_TOKEN }}
                  -X PUT 
                  -H 'Content-Type: application/json'
                  -d '{"fields":{"customfield_10008":"MEER-105"}}'
                  ${{ secrets.JIRA_BASE_URL }}/rest/api/2/issue/${{ steps.create.outputs.issue }}

Assignee?

How can we assign to a user?

I tried

    - name: Create
      id: create
      uses: atlassian/gajira-create@master
      with:
        project: ABCD
        issuetype: Task
        summary: |
          Test issue
        description: |
          This is a test
        fields: '{"assignee": "<accountId>"}'

Not having any luck. I tried account ID and email.
It creates the ticket Unassigned. If I don't set that field it creates with the default assignee.

Create under a story?

Is it possible to create an issue under a story instead of just at the project level?

Add attachments to new issue

Hi
Is it possible with this action to add attachments to a new issue?
We need it to add screenshots etc. to the new issue.

With best regards

Fail to create a JIRA issue with {{

Hey guys,

We are using your gajira-create with the GitHub issue body, but it seems that if the body has '{{' in the text the request fail. Do you have any suggestions on how can we make it work?

Error on the action:
https://github.com/codacy/helm-ssm/runs/1111647834?check_suite_focus=true

Issue triggering that error:
codacy/helm-ssm#26

Usage of gajira-create filling the description field:
https://github.com/codacy/helm-ssm/blob/master/.github/workflows/create_issue.yml#L35

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.