mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-12-13 03:15:17 +00:00
Add support for Slack Workflow triggers in push outputs relay
This commit is contained in:
parent
2bf9f7ed01
commit
3430d41111
1 changed files with 15 additions and 4 deletions
|
|
@ -70,10 +70,21 @@ async def relay(record: Dict[str, Any]):
|
|||
|
||||
text = _to_slack_text(record)
|
||||
|
||||
body = {
|
||||
"text": text,
|
||||
"mrkdwn": True,
|
||||
}
|
||||
# If using a Slack Workflow "triggers" URL, the workflow expects top-level fields
|
||||
# that match the configured variables in the Workflow (e.g., "markdown", "payload").
|
||||
# Otherwise, for Incoming Webhooks ("services" URL), use the standard {text, mrkdwn}.
|
||||
if "hooks.slack.com/triggers/" in slack_url:
|
||||
body = {
|
||||
# Map our computed text to the workflow variable named "markdown"
|
||||
"markdown": text,
|
||||
# Provide original payload if the workflow defines a variable for it
|
||||
"payload": record.get("payload", {}),
|
||||
}
|
||||
else:
|
||||
body = {
|
||||
"text": text,
|
||||
"mrkdwn": True,
|
||||
}
|
||||
|
||||
try:
|
||||
resp = requests.post(slack_url, json=body, timeout=8)
|
||||
|
|
|
|||
Loading…
Reference in a new issue