Snippets

Adaptavist Add Definition Of Done Checklist Comment To Created Issues

Created by Kristian Walker last modified
/*
* This example script listener script should be conifgured to run on the Issue Created event and as the ScriptRunner Add-On User.
* "All right, title and interest in this code snippet shall remain the exclusive intellectual property of Adaptavist Group Ltd and its affiliates. Customers with a valid ScriptRunner
* license shall be granted a  non-exclusive, non-transferable, freely revocable right to use this code snippet only within their own instance of Atlassian products. This licensing notice cannot be removed or
* amended and must be included in any circumstances where the code snippet is shared by You or a third party." 
*/

import groovy.json.JsonOutput

def adfBody = [
  "version": 1,
  "type": "doc",
  "content": [
    [
      "type": "paragraph",
      "content": [
        [
          "type": "text",
          "text": "Definition Of Done Checklist:",
        ],
      ]
    ],
    [
      "type": "rule"
    ],
    [
      "type": "paragraph",
      "content": [
        [
          "type": "text",
          "text": "Checklist:",
          "marks": [
            [
              "type": "strong"
            ]
          ]
        ]
      ]
    ],
    [
      "type": "bulletList",
      "content": [
        [
          "type": "listItem",
          "content": [
            [
              "type": "paragraph",
              "content": [
                [
                  "type": "text",
                  "text": "All Requirements on Ticket Complete."
                ]
              ]
            ]
          ]
        ],
        [
          "type": "listItem",
          "content": [
            [
              "type": "paragraph",
              "content": [
                [
                  "type": "text",
                  "text": "Pull Request reviewed by at least 2 developers."
                ]
              ]
            ]
          ]
        ],
        [
          "type": "listItem",
          "content": [
            [
              "type": "paragraph",
              "content": [
                [
                  "type": "text",
                  "text": "Thorough spot checking done and video attached to PR covering relevant edge cases."
                ],
                ],
              ]
            ]
          ],
        [
          "type": "listItem",
          "content": [
            [
              "type": "paragraph",
              "content": [
                [
                  "type": "text",
                  "text": "Unit tests all updated or added where necessary and pass."
                ]
              ]
            ]
          ]
        ],
        [
          "type": "listItem",
          "content": [
            [
              "type": "paragraph",
              "content": [
                [
                  "type": "text",
                  "text": "Appropriate Monitoring or Error detection added."
                ]
              ]
            ]
          ]
        ],
        [
          "type": "listItem",
          "content": [
            [
              "type": "paragraph",
              "content": [
                [
                  "type": "text",
                  "text": "Change fully regression tested for older code/config versions."
                ]
              ]
            ]
          ]
        ],
        [
          "type": "listItem",
          "content": [
            [
              "type": "paragraph",
              "content": [
                [
                  "type": "text",
                  "text": "Release order considered."
                ]
              ]
            ]
          ]
        ],
        [
          "type": "listItem",
          "content": [
            [
              "type": "paragraph",
              "content": [
                [
                  "type": "text",
                  "text": "Documentation updated."
                ]
              ]
            ]
          ]
        ]
      ]
    ],
    [
      "type": "rule"
    ]
  ]
]

def commentBody = [
    body: [
        type: "doc",
        version: 1,
        content: adfBody.content
    ]
]

def addComment = post("/rest/api/3/issue/${issue.key}/comment")
    .header('Content-Type', 'application/json')
    .body(JsonOutput.toJson(commentBody))
    .asJson()

assert addComment.status == 201

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.