Skip to content

Commit a7af3f7

Browse files
authored
Merge pull request #119 from partio-io/minion-multirepository
Add Minion Programs and Simplify Workflows
2 parents 455ec8f + ffdf62a commit a7af3f7

File tree

10 files changed

+251
-286
lines changed

10 files changed

+251
-286
lines changed

.github/workflows/approve.yml

Lines changed: 0 additions & 70 deletions
This file was deleted.

.github/workflows/doc-minion.yml

Lines changed: 10 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
required: true
99
type: string
1010
dry_run:
11-
description: "Dry run (prompt generation only)"
11+
description: "Dry run"
1212
required: false
1313
default: false
1414
type: boolean
@@ -23,67 +23,23 @@ jobs:
2323
timeout-minutes: 15
2424

2525
steps:
26-
# Checkout this repo (cli = principal)
27-
- name: Checkout cli
28-
uses: actions/checkout@v4
29-
with:
30-
path: cli
31-
32-
- name: Install yq
33-
run: |
34-
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
35-
sudo chmod +x /usr/local/bin/yq
36-
37-
- name: Checkout project repos
38-
env:
39-
GH_TOKEN: ${{ secrets.GH_PAT }}
40-
run: |
41-
for ENTRY in $(yq -r '.repos[] | .full_name + ":" + .name' cli/.minions/project.yaml); do
42-
FULL="${ENTRY%%:*}"
43-
SHORT="${ENTRY##*:}"
44-
if [ "$SHORT" = "cli" ]; then
45-
continue
46-
fi
47-
gh repo clone "$FULL" "$SHORT" -- --depth=1
48-
done
49-
50-
- name: Configure git auth
51-
env:
52-
GH_TOKEN: ${{ secrets.GH_PAT }}
53-
run: git config --global url."https://x-access-token:${GH_TOKEN}@github.com/".insteadOf "https://github.com/"
54-
55-
- name: Checkout minions
56-
uses: actions/checkout@v4
57-
with:
58-
repository: partio-io/minions
59-
path: minions
60-
token: ${{ secrets.GH_PAT }}
61-
62-
- name: Setup Go
63-
uses: actions/setup-go@v5
64-
with:
65-
go-version: "1.26"
66-
67-
- name: Setup Node.js
68-
uses: actions/setup-node@v4
69-
with:
70-
node-version: "22"
71-
72-
- name: Build minions
73-
run: cd minions && make build
26+
- uses: actions/checkout@v4
7427

7528
- name: Install Claude Code
7629
run: npm install -g @anthropic-ai/claude-code
7730

78-
- name: Run doc minion
31+
- name: Install minions
32+
run: |
33+
go install github.com/partio-io/minions/cmd/minions@latest
34+
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
35+
36+
- name: Run doc-update program
7937
env:
8038
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
8139
GH_TOKEN: ${{ secrets.GH_PAT }}
82-
WORKSPACE_ROOT: ${{ github.workspace }}
8340
run: |
84-
cd minions
85-
ARGS="doc --pr ${{ inputs.pr_ref }}"
41+
ARGS="run .minions/programs/doc-update.md"
8642
if [ "${{ inputs.dry_run }}" = "true" ]; then
8743
ARGS="${ARGS} --dry-run"
8844
fi
89-
./minions $ARGS
45+
minions $ARGS

.github/workflows/minion.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,13 @@ jobs:
5858
echo "issue_num=${ISSUE_NUM}" >> "$GITHUB_OUTPUT"
5959
fi
6060
61+
- name: Install Claude Code
62+
run: npm install -g @anthropic-ai/claude-code
63+
6164
- name: Install minions
62-
run: go install github.com/partio-io/minions/cmd/minions@latest
65+
run: |
66+
go install github.com/partio-io/minions/cmd/minions@latest
67+
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
6368
6469
- name: Run program
6570
env:

.github/workflows/plan.yml

Lines changed: 24 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
name: Plan Minion Task
22

33
on:
4-
# Trigger when minion-planning label is added
54
issues:
65
types: [labeled]
7-
8-
# Trigger on /minion replan comment
9-
issue_comment:
10-
types: [created]
11-
12-
# Manual trigger
136
workflow_dispatch:
147
inputs:
15-
issue_number:
16-
description: "Issue number to plan for"
8+
program:
9+
description: "Program .md file path"
1710
required: true
1811
type: string
1912

@@ -25,112 +18,41 @@ jobs:
2518
plan:
2619
if: >
2720
github.event_name == 'workflow_dispatch' ||
28-
(github.event_name == 'issues' && github.event.label.name == 'minion-planning') ||
29-
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '/minion replan'))
21+
(github.event_name == 'issues' && github.event.label.name == 'minion-planning')
3022
runs-on: ubuntu-latest
3123
timeout-minutes: 15
3224

3325
steps:
34-
- name: Check authorization
35-
env:
36-
GH_TOKEN: ${{ secrets.GH_PAT }}
37-
run: |
38-
ORG=$(echo "${{ github.repository }}" | cut -d'/' -f1)
39-
ROLE=$(gh api "orgs/${ORG}/memberships/${{ github.actor }}" --jq '.role' 2>/dev/null || echo "none")
40-
if [ "$ROLE" != "admin" ]; then
41-
echo "::error::Unauthorized: ${{ github.actor }} (role: ${ROLE}) is not an org admin"
42-
exit 1
43-
fi
44-
45-
- name: Determine issue number
46-
id: issue
47-
run: |
48-
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
49-
echo "number=${{ inputs.issue_number }}" >> "$GITHUB_OUTPUT"
50-
else
51-
echo "number=${{ github.event.issue.number }}" >> "$GITHUB_OUTPUT"
52-
fi
26+
- uses: actions/checkout@v4
5327

54-
- name: Acknowledge replan request
55-
if: github.event_name == 'issue_comment'
56-
env:
57-
GH_TOKEN: ${{ secrets.GH_PAT }}
58-
run: |
59-
ISSUE_NUM="${{ steps.issue.outputs.number }}"
60-
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
61-
gh issue comment "$ISSUE_NUM" --repo "${{ github.repository }}" \
62-
--body "Minion re-planning triggered. [View workflow run](${RUN_URL})"
63-
64-
# Checkout this repo (cli = principal)
65-
- name: Checkout cli
66-
uses: actions/checkout@v4
67-
with:
68-
path: cli
28+
- name: Install Claude Code
29+
run: npm install -g @anthropic-ai/claude-code
6930

70-
- name: Install yq
31+
- name: Install minions
7132
run: |
72-
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
73-
sudo chmod +x /usr/local/bin/yq
33+
go install github.com/partio-io/minions/cmd/minions@latest
34+
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
7435
75-
- name: Checkout project repos
36+
- name: Determine program
37+
id: program
7638
env:
7739
GH_TOKEN: ${{ secrets.GH_PAT }}
7840
run: |
79-
for ENTRY in $(yq -r '.repos[] | .full_name + ":" + .name' cli/.minions/project.yaml); do
80-
FULL="${ENTRY%%:*}"
81-
SHORT="${ENTRY##*:}"
82-
if [ "$SHORT" = "cli" ]; then
83-
continue
41+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
42+
echo "path=${{ inputs.program }}" >> "$GITHUB_OUTPUT"
43+
else
44+
ISSUE_NUM="${{ github.event.issue.number }}"
45+
ISSUE_BODY=$(gh issue view "$ISSUE_NUM" --repo "${{ github.repository }}" --json body -q '.body')
46+
PROGRAM_PATH=$(echo "$ISSUE_BODY" | grep -oP '(?<=<!-- program: ).*(?= -->)' || true)
47+
if [ -z "$PROGRAM_PATH" ]; then
48+
echo "::error::No program reference in issue #${ISSUE_NUM}"
49+
exit 1
8450
fi
85-
gh repo clone "$FULL" "$SHORT" -- --depth=1
86-
done
87-
88-
- name: Configure git auth
89-
env:
90-
GH_TOKEN: ${{ secrets.GH_PAT }}
91-
run: git config --global url."https://x-access-token:${GH_TOKEN}@github.com/".insteadOf "https://github.com/"
92-
93-
- name: Checkout minions
94-
uses: actions/checkout@v4
95-
with:
96-
repository: partio-io/minions
97-
path: minions
98-
token: ${{ secrets.GH_PAT }}
99-
100-
# Install toolchains
101-
- name: Setup Go
102-
uses: actions/setup-go@v5
103-
with:
104-
go-version: "1.26"
105-
106-
- name: Setup Node.js
107-
uses: actions/setup-node@v4
108-
with:
109-
node-version: "22"
110-
111-
- name: Build minions
112-
run: cd minions && make build
113-
114-
- name: Install Claude Code
115-
run: npm install -g @anthropic-ai/claude-code
51+
echo "path=${PROGRAM_PATH}" >> "$GITHUB_OUTPUT"
52+
fi
11653
117-
# Run plan
118-
- name: Generate plan
54+
- name: Run program with planner
11955
env:
12056
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
12157
GH_TOKEN: ${{ secrets.GH_PAT }}
122-
WORKSPACE_ROOT: ${{ github.workspace }}
123-
run: |
124-
cd minions
125-
./minions plan --issue ${{ steps.issue.outputs.number }} --repo "${{ github.repository }}"
126-
127-
# On failure: comment with logs link
128-
- name: Report failure
129-
if: failure()
130-
env:
131-
GH_TOKEN: ${{ secrets.GH_PAT }}
132-
run: |
133-
ISSUE_NUM="${{ steps.issue.outputs.number }}"
134-
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
135-
gh issue comment "$ISSUE_NUM" --repo "${{ github.repository }}" \
136-
--body "Minion planning failed. [View logs](${RUN_URL})"
58+
run: minions run ${{ steps.program.outputs.path }} --dry-run

0 commit comments

Comments
 (0)