mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-12-15 12:25:18 +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)
|
text = _to_slack_text(record)
|
||||||
|
|
||||||
body = {
|
# If using a Slack Workflow "triggers" URL, the workflow expects top-level fields
|
||||||
"text": text,
|
# that match the configured variables in the Workflow (e.g., "markdown", "payload").
|
||||||
"mrkdwn": True,
|
# 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:
|
try:
|
||||||
resp = requests.post(slack_url, json=body, timeout=8)
|
resp = requests.post(slack_url, json=body, timeout=8)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue