Repository navigation
81 lines (77 loc) · 3.22 KB
/
Copy pathassembly-loop.yml
File metadata and controls
81 lines (77 loc) · 3.22 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
name: assembly-loop
# Looper station of the agent assembly line. Runs headless Claude Code on the
# Studio's self-hosted runner; see the assembly repo for the station prompt.
#
# Starts on:
# - an issue labelled state:ready (implement and open the PR)
# - an assembly/* PR labelled state:changes-requested (address review)
# - a CodeRabbit review on an assembly/* PR that is state:in-progress
on:
issues:
types: [labeled]
# pull_request_target so the label trigger always runs main's copy of this
# workflow. The job never checks out or runs PR code itself; run-station
# works in its own worktree on the Studio.
pull_request_target: # zizmor: ignore[dangerous-triggers]
types: [labeled]
pull_request_review:
types: [submitted]
permissions: {}
jobs:
loop:
name: Loop
if: >-
vars.ASSEMBLY_ENABLED == 'true' && (
(
github.event_name == 'issues' &&
github.event.label.name == 'state:ready' &&
!contains(github.event.issue.labels.*.name, 'agent:paused')
) || (
github.event_name != 'issues' &&
github.event.pull_request.head.repo.full_name == github.repository &&
startsWith(github.event.pull_request.head.ref, 'assembly/') &&
!contains(github.event.pull_request.labels.*.name, 'agent:paused') && (
(
github.event_name == 'pull_request_target' &&
github.event.label.name == 'state:changes-requested'
) || (
github.event_name == 'pull_request_review' &&
github.event.review.user.login == 'coderabbitai[bot]' &&
contains(github.event.pull_request.labels.*.name, 'state:in-progress')
)
)
)
)
runs-on: [self-hosted, assembly]
# Job-level, not workflow-level: events this job skips (e.g. the risk:*
# label the triager adds alongside state:*) must not take the pending
# slot and cancel a real run. Keyed by item; PR branches are assembly/<issue>.
concurrency:
group: >-
item-${{ github.event.issue.number && format('assembly/{0}', github.event.issue.number) ||
github.event.pull_request.head.ref }}
timeout-minutes: 60
steps:
- name: Mint looper token
id: app
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
with:
client-id: ${{ vars.LOOPER_CLIENT_ID }}
private-key: ${{ secrets.LOOPER_APP_KEY }}
permission-contents: write
permission-issues: write
permission-pull-requests: write
permission-checks: read
permission-statuses: read
# Only numbers are passed; the agent reads issue and PR text itself with
# gh, so no user-written text reaches the shell.
- name: Run looper
env:
GH_TOKEN: ${{ steps.app.outputs.token }}
BOT_LOGIN: ${{ steps.app.outputs.app-slug }}[bot]
TRIGGER: >-
${{ github.event_name == 'issues' && 'ready' ||
github.event_name == 'pull_request_target' && 'changes-requested' ||
'coderabbit-review' }}
NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }}
run: ~/assembly/bin/run-station looper "$NUMBER"