{
"intent": "close stale issues",
"steps": [
{
"id": "issues",
"call": "github.listIssues",
"args": {
"repo": "api"
}
},
{
"id": "stale",
"let": "issues.filter(i => i.stale)"
},
{
"id": "s1",
"if": "stale.length === 0",
"return": "{ closed: 0 }"
},
{
"id": "closed",
"call": "github.closeIssue",
"each": "(stale.slice(0, 10)).map((i) => ({ number: i.number }))",
"max": 10
},
{
"id": "s2",
"call": "slack.post",
"args": {
"channel": "#eng",
"text": "=`closed ${closed.length} stale issues`"
}
}
],
"output": "{ count: closed.length }"
}