MCPcopy Create free account
hub / github.com/github/gh-aw / botIsolatedConcurrencyKey

Function botIsolatedConcurrencyKey

pkg/workflow/concurrency.go:192–202  ·  view source on GitHub ↗

botIsolatedConcurrencyKey builds a ${{ ... }} concurrency-group expression that routes GitHub App bot-triggered runs to a unique github.run_id key, preventing passive bot-authored comment events from colliding with the primary run's group. When contains(github.actor, '[bot]') is true, the expression

(primaryParts []string, tailParts []string, hasItemNumber bool)

Source from the content-addressed store, hash-verified

190// When contains(github.actor, '[bot]') is true, the expression short-circuits to
191// github.run_id so that bot-triggered runs never share a group with human runs.
192func botIsolatedConcurrencyKey(primaryParts []string, tailParts []string, hasItemNumber bool) string {
193 parts := make([]string, 0, safeAllocationCapacity(len(primaryParts), len(tailParts), 2))
194 // Prepend the bot-actor isolation check: bot runs always get a unique key
195 parts = append(parts, "contains(github.actor, '[bot]') && github.run_id")
196 parts = append(parts, primaryParts...)
197 if hasItemNumber {
198 parts = append(parts, "inputs.item_number")
199 }
200 parts = append(parts, tailParts...)
201 return "${{ " + strings.Join(parts, " || ") + " }}"
202}
203
204// hasIssueCommentTrigger returns true when the workflow has any trigger that uses
205// issue_comment events: explicit issue_comment, slash_command, or command triggers.

Callers 1

Calls 1

safeAllocationCapacityFunction · 0.85

Tested by

no test coverage detected