Skip to content

Commit 17a1aa2

Browse files
committed
Sync swarm-mode.yml from .github repo
1 parent 3679df7 commit 17a1aa2

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed

.github/workflows/swarm-mode.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Swarm Mode - Continuous Progress
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
duration_minutes:
7+
description: 'Duration in minutes (default: 60)'
8+
required: false
9+
default: '60'
10+
type: string
11+
issue_prefix:
12+
description: 'Prefix for swarm issues (default: "Swarm Task")'
13+
required: false
14+
default: 'Swarm Task'
15+
type: string
16+
17+
jobs:
18+
swarm-mode:
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 120
21+
permissions:
22+
contents: write
23+
issues: write
24+
pull-requests: write
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Run swarm mode
30+
uses: actions/github-script@v7
31+
env:
32+
DURATION_MINUTES: ${{ github.event.inputs.duration_minutes || '60' }}
33+
ISSUE_PREFIX: ${{ github.event.inputs.issue_prefix || 'Swarm Task' }}
34+
with:
35+
script: |
36+
const durationMinutes = parseInt(process.env.DURATION_MINUTES) || 60;
37+
const issuePrefix = process.env.ISSUE_PREFIX || 'Swarm Task';
38+
const startTime = Date.now();
39+
const endTime = startTime + (durationMinutes * 60 * 1000);
40+
41+
console.log(`Starting swarm mode for ${durationMinutes} minutes`);
42+
console.log(`Will run until ${new Date(endTime).toISOString()}`);
43+
44+
let taskCounter = 1;
45+
46+
// Function to create next swarm task
47+
async function createSwarmTask(counter) {
48+
const issueTitle = `${issuePrefix} #${counter}: ${new Date().toISOString().split('T')[0]}`;
49+
50+
const body = `## Swarm Task #${counter}
51+
52+
This is task #${counter} in the swarm mode session.
53+
54+
@copilot please:
55+
1. Analyze the repository to identify the highest priority task
56+
2. Complete one focused, incremental improvement
57+
3. Ensure the change is well-tested and documented
58+
4. Keep changes minimal and focused on forward progress
59+
5. Close this issue when complete
60+
61+
**Guidelines:**
62+
- Focus on quick wins (5-15 minutes per task)
63+
- Make one clear improvement at a time
64+
- Ensure all changes are tested
65+
- Document changes in commit messages
66+
- Move forward continuously
67+
68+
**Session Info:**
69+
- Session duration: ${durationMinutes} minutes
70+
- Task number: ${counter}
71+
- Started: ${new Date().toISOString()}
72+
`;
73+
74+
const issue = await github.rest.issues.create({
75+
owner: context.repo.owner,
76+
repo: context.repo.repo,
77+
title: issueTitle,
78+
body: body,
79+
labels: ['automation', 'swarm-mode', 'copilot']
80+
});
81+
82+
console.log(`Created task #${counter}:`, issue.data.html_url);
83+
84+
// Assign to copilot
85+
await github.rest.issues.addAssignees({
86+
owner: context.repo.owner,
87+
repo: context.repo.repo,
88+
issue_number: issue.data.number,
89+
assignees: ['copilot']
90+
});
91+
92+
return issue.data;
93+
}
94+
95+
// Create initial batch of tasks
96+
const batchSize = 3; // Create 3 tasks at a time
97+
console.log(`Creating initial batch of ${batchSize} tasks...`);
98+
99+
for (let i = 0; i < batchSize; i++) {
100+
await createSwarmTask(taskCounter++);
101+
await new Promise(resolve => setTimeout(resolve, 2000)); // 2 second delay
102+
}
103+
104+
console.log(`Created ${batchSize} initial tasks`);
105+
console.log(`Swarm mode session initiated. Tasks will be processed by @copilot.`);
106+
console.log(`Additional tasks can be created manually or by scheduling another swarm run.`);

0 commit comments

Comments
 (0)