Pull Request Creation - Bitbucket

This playbook creates a pull request using Bitbucket integration.

XSOAR CI/CD · 32 tasks · 4 inputs · 0 outputs

Details

IDPull Request Creation - Bitbucket
From Version6.0.0
Tasks32

README

This playbook creates a pull request using Bitbucket integration.

Dependencies

This playbook uses the following sub-playbooks, integrations, and scripts.

Sub-playbooks

This playbook does not use any sub-playbooks.

Integrations

  • Bitbucket

Scripts

  • SuggestBranchName
  • CommitFiles
  • Set
  • DeleteContext

Commands

  • bitbucket-pull-request-list
  • bitbucket-branch-get
  • bitbucket-pull-request-update
  • bitbucket-branch-create
  • bitbucket-pull-request-create

Playbook Inputs


Name Description Default Value Required
PullRequestTemplate Pull request description template.   Required
MainBranch The name of the branch you want the changes pulled into, which must be an existing branch on the current repository.   Required
PackName The name of the pack   Required
File The File or Files to commit to the new or updated branch or pr   Required

Playbook Outputs


There are no outputs for this playbook.

Inputs

  • PullRequestTemplate — Pull request description template.
  • MainBranch — The name of the branch you want the changes pulled into, which must be an existing branch on the current repository.
  • PackName — The name of the pack
  • File — The File or Files to commit to the new or updated branch or pr

Commands used

bitbucket-branch-create bitbucket-branch-get bitbucket-pull-request-create bitbucket-pull-request-list bitbucket-pull-request-update

Flowchart

yes yes yes yes yes yes Start Start Get main branch - bitbucket-branch-get Get main branch bitbucket-branch-get Create new branch - bitbucket-branch-create Create new branch bitbucket-branch-create Create pull request - bitbucket-pull-request-create Create pull request bitbucket-pull-request-create Update pr and add a reviewer - bitbucket-pull-request-update Update pr and add a reviewer bitbucket-pull-request-update Add reviewer? Add reviewer? Get branch - bitbucket-branch-get Get branch bitbucket-branch-get Does branch exist? Does branch exist? Set branch name from CI/CD Branch field - Set Set branch name from CI/C... Set Is CI/CD Branch field given Is CI/CD Branch field given Suggest branch name - SuggestBranchName Suggest branch name SuggestBranchName Set branch name from SuggestBranchName output - Set Set branch name from Sugg... Set Is CI/CD Pull Request Branch field given Is CI/CD Pull Request Bra... Set branch name from CI/CD Pull Request Branch field - Set Set branch name from CI/C... Set Get pull request list - bitbucket-pull-request-list Get pull request list bitbucket-pull-request-list Set MessageText value for update action - Set Set MessageText value for... Set Set MessageText for new pull request - Set Set MessageText for new p... Set Set the branch name Set the branch name Check if branch exists and create it if not Check if branch exists an... Commit the files Commit the files Create new pull request Create new pull request Update existing pull request Update existing pull request Create pull request with pack name as title - bitbucket-pull-request-create Create pull request with ... bitbucket-pull-request-create Is Pull Request title empty? Is Pull Request title empty? Does branch exist? Does branch exist? Find Relevant pull request ID - Set Find Relevant pull reques... Set Update relevant Pull Request - bitbucket-pull-request-update Update relevant Pull Request bitbucket-pull-request-update Set New Branch - Set Set New Branch Set Set Existing Branch - Set Set Existing Branch Set Commit files - CommitFiles Commit files CommitFiles Set pull request ID - Set Set pull request ID Set Delete pull requests list context - DeleteContext Delete pull requests lis... DeleteContext
id: Pull Request Creation - Bitbucket
version: -1
name: Pull Request Creation - Bitbucket
description: This playbook creates a pull request using Bitbucket integration.
starttaskid: "0"
tasks:
  "0":
    id: "0"
    taskid: d86c55cb-ee31-49d1-894b-9381494bc24d
    type: start
    task:
      id: d86c55cb-ee31-49d1-894b-9381494bc24d
      version: -1
      name: ""
      iscommand: false
      brand: ""
      description: ''
    nexttasks:
      '#none#':
      - "37"
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 480,
          "y": 770
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "2":
    id: "2"
    taskid: f5a42e52-347c-4a01-80db-e680c02bf116
    type: regular
    task:
      id: f5a42e52-347c-4a01-80db-e680c02bf116
      version: -1
      name: Get main branch
      description: Returns the information of the requested branch.
      script: Bitbucket|||bitbucket-branch-get
      type: regular
      iscommand: true
      brand: Bitbucket
    nexttasks:
      '#none#':
      - "38"
    scriptarguments:
      branch_name:
        complex:
          root: inputs.MainBranch
      partial_response:
        simple: "false"
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 480,
          "y": 1740
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "3":
    id: "3"
    taskid: 7854b10d-468f-4b82-8105-4ed76633829c
    type: regular
    task:
      id: 7854b10d-468f-4b82-8105-4ed76633829c
      version: -1
      name: Create new branch
      description: Creates a new branch in Bitbucket.
      script: Bitbucket|||bitbucket-branch-create
      type: regular
      iscommand: true
      brand: Bitbucket
    nexttasks:
      '#none#':
      - "53"
    scriptarguments:
      name:
        simple: ${BranchName}
      partial_response:
        simple: "false"
      target_branch:
        simple: ${inputs.MainBranch}
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": -2.5,
          "y": 2330
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "7":
    id: "7"
    taskid: e403e278-322c-46e8-8b8b-3dd6606aafa4
    type: regular
    task:
      id: e403e278-322c-46e8-8b8b-3dd6606aafa4
      version: -1
      name: Create pull request
      description: Creates a pull request in Bitbucket.
      script: Bitbucket|||bitbucket-pull-request-create
      type: regular
      iscommand: true
      brand: Bitbucket
    nexttasks:
      '#none#':
      - "61"
    scriptarguments:
      description:
        simple: ${PR_text}
      destination_branch:
        simple: ${inputs.MainBranch}
      partial_response:
        simple: "false"
      source_branch:
        simple: ${BranchName}
      title:
        complex:
          root: incident
          accessor: cicdpullrequesttitle
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 480,
          "y": 3400
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "8":
    id: "8"
    taskid: 8bfe8482-c988-4fc6-8ca4-6bc324fd28b7
    type: regular
    task:
      id: 8bfe8482-c988-4fc6-8ca4-6bc324fd28b7
      version: -1
      name: Update pr and add a reviewer
      description: Updates a pull request in Bitbucket.
      script: Bitbucket|||bitbucket-pull-request-update
      type: regular
      iscommand: true
      brand: Bitbucket
    nexttasks:
      '#none#':
      - "36"
    scriptarguments:
      partial_response:
        simple: "false"
      pull_request_id:
        simple: ${pr_id}
      reviewer_id:
        simple: ${incident.cicdreviewer}
    separatecontext: false
    continueonerror: true
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 370,
          "y": 3940
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "9":
    id: "9"
    taskid: 8298ec25-9696-4c94-8ee3-f72a1e8690e9
    type: condition
    task:
      id: 8298ec25-9696-4c94-8ee3-f72a1e8690e9
      version: -1
      name: Add reviewer?
      type: condition
      iscommand: false
      brand: ""
      description: Add reviewer?
    nexttasks:
      '#default#':
      - "36"
      "yes":
      - "8"
    separatecontext: false
    conditions:
    - label: "yes"
      condition:
      - - operator: isNotEmpty
          left:
            value:
              simple: incident.cicdreviewer
            iscontext: true
          ignorecase: true
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 265,
          "y": 3765
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "18":
    id: "18"
    taskid: 00dac337-ab4b-4162-8343-d4d22e86be5f
    type: regular
    task:
      id: 00dac337-ab4b-4162-8343-d4d22e86be5f
      version: -1
      name: Get branch
      description: Returns the information of the requested branch.
      script: Bitbucket|||bitbucket-branch-get
      type: regular
      iscommand: true
      brand: Bitbucket
    nexttasks:
      '#none#':
      - "19"
    scriptarguments:
      branch_name:
        simple: ${BranchName}
      partial_response:
        simple: "false"
    separatecontext: false
    continueonerror: true
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 480,
          "y": 2060
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "19":
    id: "19"
    taskid: 488bc2c9-12f3-4498-8b84-3bfe9997d0fc
    type: condition
    task:
      id: 488bc2c9-12f3-4498-8b84-3bfe9997d0fc
      version: -1
      name: Does branch exist?
      type: condition
      iscommand: false
      brand: ""
      description: Does branch exist?
    nexttasks:
      '#default#':
      - "3"
      "yes":
      - "54"
    separatecontext: false
    conditions:
    - label: "yes"
      condition:
      - - operator: isEqualString
          left:
            value:
              simple: Bitbucket.Branch.name
            iscontext: true
          right:
            value:
              simple: ${BranchName}
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 480,
          "y": 2235
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "25":
    id: "25"
    taskid: 6eb1c82f-8fc3-4084-8d18-82946de541f1
    type: regular
    task:
      id: 6eb1c82f-8fc3-4084-8d18-82946de541f1
      version: -1
      name: Set branch name from CI/CD Branch field
      description: Set a value in context under the key you entered.
      scriptName: Set
      type: regular
      iscommand: false
      brand: ""
    nexttasks:
      '#none#':
      - "2"
    scriptarguments:
      key:
        simple: BranchName
      value:
        complex:
          root: incident
          accessor: cicdbranch
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 480,
          "y": 1565
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "26":
    id: "26"
    taskid: 49e2bc42-ebeb-4a15-8337-58c7dd129cde
    type: condition
    task:
      id: 49e2bc42-ebeb-4a15-8337-58c7dd129cde
      version: -1
      name: Is CI/CD Branch field given
      type: condition
      iscommand: false
      brand: ""
      description: Is there a branch name in the update branch field in the incident.
    nexttasks:
      '#default#':
      - "27"
      "yes":
      - "25"
    separatecontext: false
    conditions:
    - label: "yes"
      condition:
      - - operator: isNotEmpty
          left:
            value:
              simple: incident.cicdbranch
            iscontext: true
          right:
            value: {}
          ignorecase: true
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 265,
          "y": 1215
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "27":
    id: "27"
    taskid: d0e33d0c-e500-43b2-80fa-700ce7afa41b
    type: regular
    task:
      id: d0e33d0c-e500-43b2-80fa-700ce7afa41b
      version: -1
      name: Suggest branch name
      description: |
        The script gets the pack name as input and suggests an available branch name, for example:
        pack name is "MyPack" the branch name will be "MyPack".
        If a branch with the name "MyPack" exists, the script return "MyPack_1".
      scriptName: SuggestBranchName
      type: regular
      iscommand: false
      brand: ""
    nexttasks:
      '#none#':
      - "28"
    scriptarguments:
      command_get_branch:
        simple: bitbucket-branch-get
      pack:
        simple: ${inputs.PackName}
      use_command:
        simple: bitbucket-branch-get
    separatecontext: false
    continueonerror: true
    continueonerrortype: errorPath
    view: |-
      {
        "position": {
          "x": 50,
          "y": 1390
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "28":
    id: "28"
    taskid: 29e188fd-abee-43d2-87e6-d8a116ffb6c1
    type: regular
    task:
      id: 29e188fd-abee-43d2-87e6-d8a116ffb6c1
      version: -1
      name: Set branch name from SuggestBranchName output
      description: Set a value in context under the key you entered.
      scriptName: Set
      type: regular
      iscommand: false
      brand: ""
    nexttasks:
      '#none#':
      - "2"
    scriptarguments:
      key:
        simple: BranchName
      value:
        complex:
          root: AvailableBranch
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 50,
          "y": 1565
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "29":
    id: "29"
    taskid: 12f1b1dd-ff77-4f10-8685-048ecf3d6c79
    type: condition
    task:
      id: 12f1b1dd-ff77-4f10-8685-048ecf3d6c79
      version: -1
      name: Is CI/CD Pull Request Branch field given
      type: condition
      iscommand: false
      brand: ""
      description: Is there a branch name in the matching field in the CI/CD incident.
    nexttasks:
      '#default#':
      - "26"
      "yes":
      - "30"
    separatecontext: false
    conditions:
    - label: "yes"
      condition:
      - - operator: isNotEmpty
          left:
            value:
              simple: incident.cicdpullrequestbranch
            iscontext: true
          right:
            value: {}
          ignorecase: true
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 480,
          "y": 1040
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "30":
    id: "30"
    taskid: d3e2f12a-5a7b-41cc-8839-b0cbaabf1d93
    type: regular
    task:
      id: d3e2f12a-5a7b-41cc-8839-b0cbaabf1d93
      version: -1
      name: Set branch name from CI/CD Pull Request Branch field
      description: Set a value in context under the key you entered.
      scriptName: Set
      type: regular
      iscommand: false
      brand: ""
    nexttasks:
      '#none#':
      - "2"
    scriptarguments:
      key:
        simple: BranchName
      value:
        complex:
          root: incident
          accessor: cicdpullrequestbranch
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 910,
          "y": 1565
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "31":
    id: "31"
    taskid: 288e437c-3d39-43a0-8da6-1182ba55be70
    type: regular
    task:
      id: 288e437c-3d39-43a0-8da6-1182ba55be70
      version: -1
      name: Get pull request list
      description: Returns a list of the pull requests. If a state is provided than the list will contain only PRs with the wanted status. If a state is not provided, by default a list of the open pull requests will return.
      script: Bitbucket|||bitbucket-pull-request-list
      type: regular
      iscommand: true
      brand: Bitbucket
    nexttasks:
      '#none#':
      - "51"
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 807.5,
          "y": 3750
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "35":
    id: "35"
    taskid: 22676e85-9356-4147-8527-d0d5e6846d79
    type: regular
    task:
      id: 22676e85-9356-4147-8527-d0d5e6846d79
      version: -1
      name: Set MessageText value for update action
      description: Set a value in context under the key you entered.
      scriptName: Set
      type: regular
      iscommand: false
      brand: ""
    scriptarguments:
      key:
        simple: MessageText
      value:
        simple: |-
          This pull request for the pack ${PackName} was updated by ${DemistoUsers.[0].username}:
          ${Bitbucket.PullRequest.links.html.href}
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 807.5,
          "y": 4415
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "36":
    id: "36"
    taskid: e90aa56f-ddc5-4623-85e1-7e4309ee2572
    type: regular
    task:
      id: e90aa56f-ddc5-4623-85e1-7e4309ee2572
      version: -1
      name: Set MessageText for new pull request
      description: Set a value in context under the key you entered.
      scriptName: Set
      type: regular
      iscommand: false
      brand: ""
    scriptarguments:
      key:
        simple: MessageText
      value:
        simple: |-
          New pull request was created by ${DemistoUsers.[0].username} for the pack ${PackName}:
          https://github.com/${GitHub.PR.Head.Repo.FullName}/pull/${GitHub.PR.Number}
          https://bitbucket.org//${Bitbucket.PullRequest.destination.repository.full_name}/pull-requests/6
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 265,
          "y": 4105
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "37":
    id: "37"
    taskid: e5037068-a16a-47ae-8b18-ae26506bd7cb
    type: title
    task:
      id: e5037068-a16a-47ae-8b18-ae26506bd7cb
      version: -1
      name: Set the branch name
      type: title
      iscommand: false
      brand: ""
      description: ''
    nexttasks:
      '#none#':
      - "29"
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 480,
          "y": 925
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "38":
    id: "38"
    taskid: 2d04a827-86ff-4e0d-8ebe-5055cc6fe6b8
    type: title
    task:
      id: 2d04a827-86ff-4e0d-8ebe-5055cc6fe6b8
      version: -1
      name: Check if branch exists and create it if not
      type: title
      iscommand: false
      brand: ""
      description: ''
    nexttasks:
      '#none#':
      - "18"
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 480,
          "y": 1915
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "39":
    id: "39"
    taskid: f2f57205-580c-43d8-80bf-bc62fa6d5487
    type: title
    task:
      id: f2f57205-580c-43d8-80bf-bc62fa6d5487
      version: -1
      name: Commit the files
      type: title
      iscommand: false
      brand: ""
      description: ''
    nexttasks:
      '#none#':
      - "59"
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 480,
          "y": 2585
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "40":
    id: "40"
    taskid: 077047a3-61f1-4fb0-8211-900642e58874
    type: title
    task:
      id: 077047a3-61f1-4fb0-8211-900642e58874
      version: -1
      name: Create new pull request
      type: title
      iscommand: false
      brand: ""
      description: ''
    nexttasks:
      '#none#':
      - "46"
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 265,
          "y": 3080
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "41":
    id: "41"
    taskid: 8e9586bc-002c-47c9-800f-c36eb09d7699
    type: title
    task:
      id: 8e9586bc-002c-47c9-800f-c36eb09d7699
      version: -1
      name: Update existing pull request
      type: title
      iscommand: false
      brand: ""
      description: ''
    nexttasks:
      '#none#':
      - "31"
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 807.5,
          "y": 3590
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "45":
    id: "45"
    taskid: 3676241c-b3fe-4bf3-8470-8f175624f850
    type: regular
    task:
      id: 3676241c-b3fe-4bf3-8470-8f175624f850
      version: -1
      name: Create pull request with pack name as title
      description: Creates a pull request in Bitbucket.
      script: Bitbucket|||bitbucket-pull-request-create
      type: regular
      iscommand: true
      brand: Bitbucket
    nexttasks:
      '#none#':
      - "61"
    scriptarguments:
      close_source_branch:
        simple: "yes"
      description:
        simple: ${PR_text}
      destination_branch:
        simple: ${inputs.MainBranch}
      partial_response:
        simple: "false"
      source_branch:
        simple: ${BranchName}
      title:
        simple: ${inputs.PackName}
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 50,
          "y": 3400
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "46":
    id: "46"
    taskid: a5eeca70-dfe3-4aba-8a3c-d1b1ea2af164
    type: condition
    task:
      id: a5eeca70-dfe3-4aba-8a3c-d1b1ea2af164
      version: -1
      name: Is Pull Request title empty?
      type: condition
      iscommand: false
      brand: ""
      description: Is the field of the pull request title in the incident empty?
    nexttasks:
      '#default#':
      - "7"
      "yes":
      - "45"
    separatecontext: false
    conditions:
    - label: "yes"
      condition:
      - - operator: isEmpty
          left:
            value:
              complex:
                root: incident
                accessor: cicdpullrequesttitle
            iscontext: true
          ignorecase: true
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 265,
          "y": 3225
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "48":
    id: "48"
    taskid: bfcb6672-680d-4deb-822c-a220fadb3066
    type: condition
    task:
      id: bfcb6672-680d-4deb-822c-a220fadb3066
      version: -1
      name: Does branch exist?
      type: condition
      iscommand: false
      brand: ""
      description: Does branch exist?
    nexttasks:
      '#default#':
      - "40"
      "yes":
      - "41"
    separatecontext: false
    conditions:
    - label: "yes"
      condition:
      - - operator: isEqualString
          left:
            value:
              complex:
                root: IsExistingBranch
            iscontext: true
          right:
            value:
              simple: "True"
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 480,
          "y": 2900
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "51":
    id: "51"
    taskid: 686ddd41-4851-4fb8-82d1-11c7e5de254e
    type: regular
    task:
      id: 686ddd41-4851-4fb8-82d1-11c7e5de254e
      version: -1
      name: Find Relevant pull request ID
      description: Set a value in context under the key you entered.
      scriptName: Set
      type: regular
      iscommand: false
      brand: ""
    nexttasks:
      '#none#':
      - "62"
    scriptarguments:
      key:
        simple: pr_id
      value:
        complex:
          root: Bitbucket.PullRequest
          filters:
          - - operator: isEqualString
              left:
                value:
                  simple: Bitbucket.PullRequest.source.branch.name
                iscontext: true
              right:
                value:
                  simple: ${BranchName}
          accessor: id
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 807.5,
          "y": 3915
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "52":
    id: "52"
    taskid: 56d14a65-0d86-4b28-8514-79c29e8d5cf7
    type: regular
    task:
      id: 56d14a65-0d86-4b28-8514-79c29e8d5cf7
      version: -1
      name: Update relevant Pull Request
      description: Updates a pull request in Bitbucket.
      script: Bitbucket|||bitbucket-pull-request-update
      type: regular
      iscommand: true
      brand: Bitbucket
    nexttasks:
      '#none#':
      - "35"
    scriptarguments:
      description:
        simple: ${PR_text}
      partial_response:
        simple: "false"
      pull_request_id:
        simple: ${pr_id}
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 807.5,
          "y": 4250
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "53":
    id: "53"
    taskid: 734bea9f-7747-46c5-802d-7642b5fbb2d3
    type: regular
    task:
      id: 734bea9f-7747-46c5-802d-7642b5fbb2d3
      version: -1
      name: Set New Branch
      description: Set a value in context under the key you entered.
      scriptName: Set
      type: regular
      iscommand: false
      brand: ""
    nexttasks:
      '#none#':
      - "39"
    scriptarguments:
      key:
        simple: IsExistingBranch
      value:
        simple: "False"
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": -2.5,
          "y": 2490
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "54":
    id: "54"
    taskid: 5f97952d-2994-403e-8200-e0cbcd99ab0b
    type: regular
    task:
      id: 5f97952d-2994-403e-8200-e0cbcd99ab0b
      version: -1
      name: Set Existing Branch
      description: Set a value in context under the key you entered.
      scriptName: Set
      type: regular
      iscommand: false
      brand: ""
    nexttasks:
      '#none#':
      - "39"
    scriptarguments:
      key:
        simple: IsExistingBranch
      value:
        simple: "True"
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 890,
          "y": 2410
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "59":
    id: "59"
    taskid: acaa4412-efd4-4a50-8287-84300b7faf7c
    type: regular
    task:
      id: acaa4412-efd4-4a50-8287-84300b7faf7c
      version: -1
      name: Commit files
      description: This script gets content files as input from the context, commits the files in the correct folder and creates the pull request text.
      scriptName: CommitFiles
      type: regular
      iscommand: false
      brand: ""
    nexttasks:
      '#none#':
      - "48"
    scriptarguments:
      branch:
        complex:
          root: BranchName
      comment:
        complex:
          root: incident
          accessor: cicdpullrequestcomment
      files:
        simple: ${inputs.File}
      git_integration:
        simple: Bitbucket
      pack:
        simple: ${inputs.PackName}
      template:
        complex:
          root: inputs.PullRequestTemplate
      user:
        complex:
          root: DemistoUsers
          transformers:
          - operator: FirstArrayElement
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 480,
          "y": 2720
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "61":
    id: "61"
    taskid: 731b2e87-10dd-49ac-8d0d-81edfa6d9022
    type: regular
    task:
      id: 731b2e87-10dd-49ac-8d0d-81edfa6d9022
      version: -1
      name: Set pull request ID
      description: Set a value in context under the key you entered.
      scriptName: Set
      type: regular
      iscommand: false
      brand: ""
    nexttasks:
      '#none#':
      - "9"
    scriptarguments:
      key:
        simple: pr_id
      value:
        simple: ${Bitbucket.PullRequest.id}
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 265,
          "y": 3575
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
  "62":
    id: "62"
    taskid: 2d5b6e10-8a09-43ba-8a76-df3b95eb498d
    type: regular
    task:
      id: 2d5b6e10-8a09-43ba-8a76-df3b95eb498d
      version: -1
      name: Delete  pull requests list context
      description: |-
        Delete field from context.

        This automation runs using the default Limited User role, unless you explicitly change the permissions.
        For more information, see the section about permissions here:
        - For Cortex XSOAR 6 see https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/6.x/Cortex-XSOAR-Playbook-Design-Guide/Automations 
        - For Cortex XSOAR 8 Cloud see https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/8/Cortex-XSOAR-Cloud-Documentation/Create-a-script
        - For Cortex XSOAR 8.7 On-prem see https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/8.7/Cortex-XSOAR-On-prem-Documentation/Create-a-script
      scriptName: DeleteContext
      type: regular
      iscommand: false
      brand: ""
    nexttasks:
      '#none#':
      - "52"
    scriptarguments:
      key:
        simple: Bitbucket.PullRequest
    separatecontext: false
    continueonerrortype: ""
    view: |-
      {
        "position": {
          "x": 807.5,
          "y": 4080
        }
      }
    note: false
    timertriggers: []
    ignoreworker: false
    skipunavailable: false
    quietmode: 0
    isoversize: false
    isautoswitchedtoquietmode: false
view: |-
  {
    "linkLabelsPosition": {},
    "paper": {
      "dimensions": {
        "height": 3740,
        "width": 1292.5,
        "x": -2.5,
        "y": 770
      }
    }
  }
inputs:
- key: PullRequestTemplate
  value: {}
  required: true
  description: Pull request description template.
  playbookInputQuery:
- key: MainBranch
  value: {}
  required: true
  description: The name of the branch you want the changes pulled into, which must be an existing branch on the current repository.
  playbookInputQuery:
- key: PackName
  value: {}
  required: true
  description: The name of the pack
  playbookInputQuery:
- key: File
  value: {}
  required: true
  description: The File or Files to commit to the new or updated branch or pr
  playbookInputQuery:
outputs: []
tests:
- No tests (auto formatted)
fromversion: 6.0.0