-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
113 lines (107 loc) · 3.79 KB
/
Copy pathaction.yml
File metadata and controls
113 lines (107 loc) · 3.79 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
113
name: 'github-agent'
description: 'Autonomous PR review and issue-to-PR engineering with Claude — review every PR or auto-fix labeled issues, no local setup.'
author: 'Hadar01'
branding:
icon: 'git-pull-request'
color: 'purple'
inputs:
command:
description: 'Which pipeline to run: review | issue | triage'
required: true
target:
description: >-
GitHub issue / PR / repo URL to act on. If omitted, it is derived from the
triggering event (the PR URL on pull_request, the issue URL on issues).
required: false
default: ''
anthropic-api-key:
description: 'Anthropic API key. Store it as an encrypted repo/org secret.'
required: true
github-token:
description: 'Token used for GitHub API calls. Defaults to the workflow token.'
required: false
default: ${{ github.token }}
post:
description: '(review) Post the review back to the PR. true/false.'
required: false
default: 'true'
comment:
description: '(issue) Comment a link-back on the source issue after the PR opens. true/false.'
required: false
default: 'false'
fork:
description: '(issue) Push to your fork and open the PR from there. true/false.'
required: false
default: 'false'
fail-on-request-changes:
description: >-
(review) If true, a REQUEST_CHANGES / NEEDS_DISCUSSION verdict fails the
check and blocks merge. If false (default), the review is advisory: it
posts findings but never turns the check red.
required: false
default: 'false'
max-cost:
description: 'Hard USD ceiling for the run (passed as --max-cost). Empty = project default.'
required: false
default: ''
node-version:
description: 'Node.js version to run the agent with.'
required: false
default: '20'
extra-args:
description: 'Additional raw CLI flags appended verbatim (e.g. "--label=bug --max=3").'
required: false
default: ''
outputs:
verdict:
description: 'Review verdict: APPROVE / REQUEST_CHANGES / NEEDS_DISCUSSION / UNKNOWN.'
value: ${{ steps.run.outputs.verdict }}
runs:
using: 'composite'
steps:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
- name: Install github-agent dependencies
shell: bash
run: npm ci --omit=dev --prefix "${{ github.action_path }}"
- name: Resolve target URL
id: target
shell: bash
env:
EXPLICIT_TARGET: ${{ inputs.target }}
PR_URL: ${{ github.event.pull_request.html_url }}
ISSUE_URL: ${{ github.event.issue.html_url }}
run: |
TARGET="$EXPLICIT_TARGET"
if [ -z "$TARGET" ]; then
if [ -n "$PR_URL" ]; then
TARGET="$PR_URL"
elif [ -n "$ISSUE_URL" ]; then
TARGET="$ISSUE_URL"
fi
fi
if [ -z "$TARGET" ]; then
echo "::error::No target URL. Set the 'target' input, or trigger on pull_request / issues."
exit 1
fi
echo "url=$TARGET" >> "$GITHUB_OUTPUT"
- name: Run github-agent
id: run
shell: bash
env:
ANTHROPIC_API_KEY: ${{ inputs.anthropic-api-key }}
GITHUB_TOKEN: ${{ inputs.github-token }}
run: |
ARGS=()
if [ "${{ inputs.command }}" = "review" ]; then
[ "${{ inputs.post }}" = "true" ] && ARGS+=(--post)
[ "${{ inputs.fail-on-request-changes }}" != "true" ] && ARGS+=(--advisory)
fi
[ "${{ inputs.comment }}" = "true" ] && ARGS+=(--comment)
[ "${{ inputs.fork }}" = "true" ] && ARGS+=(--fork)
[ -n "${{ inputs.max-cost }}" ] && ARGS+=(--max-cost=${{ inputs.max-cost }})
node "${{ github.action_path }}/src/pipeline.js" \
"${{ inputs.command }}" "${{ steps.target.outputs.url }}" \
"${ARGS[@]}" ${{ inputs.extra-args }}