forked from docker/cagent-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
112 lines (105 loc) · 3.94 KB
/
action.yml
File metadata and controls
112 lines (105 loc) · 3.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: "PR Review Reply"
description: "Responds to developer feedback on PR review comments"
author: "Docker"
inputs:
thread-context:
description: "Thread context (original comment + replies) to respond to"
required: true
comment-id:
description: "ID of the triggering comment (for failure notification reaction)"
required: false
anthropic-api-key:
description: "Anthropic API key"
required: false
openai-api-key:
description: "OpenAI API key"
required: false
google-api-key:
description: "Google API key for Gemini models"
required: false
aws-bearer-token-bedrock:
description: "AWS Bearer token for Bedrock models"
required: false
xai-api-key:
description: "xAI API key for Grok models"
required: false
nebius-api-key:
description: "Nebius API key"
required: false
mistral-api-key:
description: "Mistral API key"
required: false
github-token:
description: "GitHub token for API access"
required: false
org-membership-token:
description: "PAT with read:org scope for org membership authorization checks"
required: false
default: ""
auth-org:
description: "GitHub organization to check membership against"
required: false
default: ""
skip-auth:
description: "Skip the built-in authorization check (caller already verified auth)"
required: false
default: "false"
outputs:
agent-outcome:
description: "Outcome of the reply agent (success/failure/skipped)"
value: ${{ steps.run-reply.outcome }}
runs:
using: "composite"
steps:
- name: Ensure cache directory exists
shell: bash
run: mkdir -p "${{ github.workspace }}/.cache"
- name: Restore reviewer memory
id: restore-memory
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ${{ github.workspace }}/.cache/pr-review-memory.db
key: pr-review-memory-${{ github.repository }}-reply-${{ github.run_id }}
restore-keys: |
pr-review-memory-${{ github.repository }}-reply-
pr-review-memory-${{ github.repository }}-
- name: Run reply agent
id: run-reply
continue-on-error: true
uses: docker/cagent-action@dba0ca51938c78afb363625363c50582243218d6 # v1.3.1
with:
agent: ${{ github.action_path }}/../agents/pr-review-reply.yaml
prompt: ${{ inputs.thread-context }}
timeout: "300"
anthropic-api-key: ${{ inputs.anthropic-api-key }}
openai-api-key: ${{ inputs.openai-api-key }}
google-api-key: ${{ inputs.google-api-key }}
aws-bearer-token-bedrock: ${{ inputs.aws-bearer-token-bedrock }}
xai-api-key: ${{ inputs.xai-api-key }}
nebius-api-key: ${{ inputs.nebius-api-key }}
mistral-api-key: ${{ inputs.mistral-api-key }}
github-token: ${{ inputs.github-token }}
org-membership-token: ${{ inputs.org-membership-token }}
auth-org: ${{ inputs.auth-org }}
skip-auth: ${{ inputs.skip-auth }}
- name: Save reviewer memory
if: always() && steps.run-reply.outcome != 'skipped'
continue-on-error: true
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ${{ github.workspace }}/.cache/pr-review-memory.db
key: pr-review-memory-${{ github.repository }}-reply-${{ github.run_id }}
# Add a "confused" reaction to the triggering comment if the agent failed,
# so the developer knows their reply wasn't processed.
- name: React on failure
if: always() && steps.run-reply.outcome == 'failure' && inputs.comment-id != ''
continue-on-error: true
shell: bash
env:
GH_TOKEN: ${{ inputs.github-token }}
REPO: ${{ github.repository }}
COMMENT_ID: ${{ inputs.comment-id }}
run: |
gh api "repos/$REPO/pulls/comments/$COMMENT_ID/reactions" \
-f content="confused" --silent || true
echo "😕 Added reaction to indicate reply failed"