Skip to content

Instantly share code, notes, and snippets.

@cpoile
Last active January 7, 2020 22:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cpoile/09100e8ee79e5b4f26e837e6b3a69723 to your computer and use it in GitHub Desktop.
Save cpoile/09100e8ee79e5b4f26e837e6b3a69723 to your computer and use it in GitHub Desktop.
Example workflow.json working with Master (Beta - after moving to storing Ids)
[
{
"name": "security_issue",
"triggers": [
{
"name": "IssueReported",
"type": "text",
"match": "#sec",
"channel_name": "",
"team_name": ""
}
],
"steps": [
{
"name": "Setup",
"start_actions": [
{
"name": "CreateWarroom",
"type": "create_channel",
"channel_name": "security-issue-{{.Instance.Number}}",
"team_name": "TestTeam",
"channel_displayname": "Security Issue {{.Instance.Number}}"
},
{
"name": "AddUsers",
"type": "add_users_channel",
"channel_id": "{{.Action.CreateWarroom.ChannelId}}",
"users": [
"jon",
"chris"
]
},
{
"type": "post",
"name": "attention_post",
"channel_name": "Town Square",
"team_name": "TestTeam",
"message": "Security issue reported. War room created: ~{{.Action.CreateWarroom.ChannelName}}"
},
{
"type": "transition_to",
"name": "TransitionToTriage",
"to": "Triage"
}
]
},
{
"name": "Triage",
"start_actions": [
{
"name": "ChuckNorris",
"type": "request",
"url": "https://api.chucknorris.io/jokes/random",
"response_format": "json"
},
{
"name": "TriagePost",
"type": "post",
"channel_id": "{{.Action.CreateWarroom.ChannelId}}",
"message": "New issue to triage:\n ```{{.Trigger.IssueReported.Message}}```\n\nHere's an important fact about Chuck Norris: `{{.Request.ChuckNorris.value}}`",
"fields_title": "Please add details to this issue",
"fields": [
{
"name": "Alert",
"type": "button",
"description": "Alert the Sysadmin to take immediate action"
},
{
"name": "Likelihood",
"description": "How likely the security issue is to be exploited.",
"type": "options",
"options": [
"L1",
"L2",
"L3"
]
},
{
"name": "Impact",
"type": "options",
"description": "The impact of the security issue if exploited",
"options": [
"I1",
"I2",
"I3"
]
},
{
"name": "Severity",
"type": "options",
"description": "Derived from Impact and Likelihood",
"options": [
"S1",
"S2",
"S3"
]
}
],
"transitions_title": "Transition to step",
"transitions": [
{
"label": "Triaged",
"description": "Issue has been triaged",
"to": "DevelopFix"
},
{
"label": "Resolved",
"description": "Issue has been resolved",
"to": "Resolved"
}
]
}
],
"finish_actions": [
{
"name": "TriageConfirmation",
"type": "post",
"channel_id": "{{.Action.CreateWarroom.ChannelId}}",
"message": "Finished Triage"
}
]
},
{
"name": "DevelopFix",
"start_actions": [
{
"name": "InfoPost",
"type": "post",
"channel_id": "{{.Action.CreateWarroom.ChannelId}}",
"message": "Developing a fix underway. Issue information:\n\nLikelihood: {{.Action.TriagePost.Likelihood}}\nImpact: {{.Action.TriagePost.Impact}}\nSeverity: {{.Action.TriagePost.Severity}}",
"transitions": [
{
"label": "Triage",
"description": "Return to triage.",
"to": "Triage"
},
{
"label": "Resolved",
"description": "Close issue as resolved",
"to": "Resolved"
}
]
}
]
},
{
"name": "Resolved",
"start_actions": [
{
"name": "ResolveWarroom",
"type": "post",
"channel_id": "{{.Action.CreateWarroom.ChannelId}}",
"message": "Resolved."
},
{
"name": "PostResolved",
"type": "post",
"channel_name": "town-square",
"team_name": "TestTeam",
"message": "Resolved Security Issue {{.Instance.Number}}"
},
{
"name": "ArchiveSecurityChannel",
"type": "archive_channel",
"channel_id": "{{.Action.CreateWarroom.ChannelId}}"
}
]
}
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment