GetPrBranches
Field-display script that gets the branch names from "Pull Request Creation" incidents to use in the "Pull Request Branch" incident field.
- Type
- python
- Pack
- ContentManagement
Source
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
""" MAIN FUNCTION """
def main():
try:
branches = [""]
res = execute_command("GetIncidentsByQuery", {"incidentTypes": "Pull Request Creation"})
incidents_from_query = json.loads(res)
for incident in incidents_from_query:
branch = incident.get("CustomFields", {}).get("cicdbranch")
if branch:
branches.append(branch)
output = {"hidden": False, "options": sorted(branches)}
return_results(output)
except Exception as ex:
demisto.error(str(ex)) # print the traceback
return_error(f"Failed to execute script. Error: {ex}", error=ex)
""" ENTRY POINT """
if __name__ in ("__main__", "__builtin__", "builtins"):
main()
README
Field-display script that gets the branch names from “Pull Request Creation” incidents to use in the “Pull Request Branch” incident field.
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Tags | field-display |
| Cortex XSOAR Version | 6.0.0 |
Inputs
There are no inputs for this script.
Outputs
There are no outputs for this script.