-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloud-schedule.ts
More file actions
95 lines (90 loc) · 2.38 KB
/
cloud-schedule.ts
File metadata and controls
95 lines (90 loc) · 2.38 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
/**
* cloud-schedule.ts
*
* Example registration of maintain-agent-rules as a scheduled workflow in
* AgentWorkforce/cloud ("Easy agent infra"). This file is illustrative —
* cloud's scheduling API is not yet active, so do not attempt to run this
* directly. It exists to document the intended shape and to be ready when
* cloud lands.
*
* When cloud is live, the registration flow will look roughly like:
*
* 1. Import the cloud SDK
* 2. Describe the workflow source (this repo + path)
* 3. Describe the target repo(s) to run against
* 4. Describe the schedule (cron, event, or manual)
* 5. Register — cloud clones the target repo, runs the workflow, and
* opens the PR on completion
*
* The actual API is TBD. The block below is a plausible sketch.
*/
// import { Cloud } from '@agentworkforce/cloud-sdk' // not yet published
interface ScheduleSketch {
name: string
source: {
repo: string
ref: string
path: string
}
target: {
repo: string
baseBranch: string
}
env: Record<string, string>
schedule: string // cron expression
timeoutMs: number
}
const schedules: ScheduleSketch[] = [
{
name: 'relayed-rules-hygiene',
source: {
repo: 'AgentWorkforce/workflows',
ref: 'main',
path: 'repeatable/maintain-agent-rules/workflow.ts',
},
target: {
repo: 'AgentWorkforce/relayed',
baseBranch: 'main',
},
env: {
SINCE_REF: 'HEAD~100',
DRY_RUN: 'false',
},
// Every Monday at 6am UTC
schedule: '0 6 * * 1',
timeoutMs: 3_600_000,
},
{
name: 'cloud-rules-hygiene',
source: {
repo: 'AgentWorkforce/workflows',
ref: 'main',
path: 'repeatable/maintain-agent-rules/workflow.ts',
},
target: {
repo: 'AgentWorkforce/cloud',
baseBranch: 'main',
},
env: {
SINCE_REF: 'HEAD~100',
DRY_RUN: 'false',
},
schedule: '0 6 * * 1',
timeoutMs: 3_600_000,
},
]
async function register() {
// const cloud = new Cloud({ apiKey: process.env.CLOUD_API_KEY! })
// for (const s of schedules) {
// await cloud.schedules.create(s)
// console.log(`registered: ${s.name}`)
// }
console.log('cloud SDK not yet wired up — intended schedules:')
for (const s of schedules) {
console.log(` ${s.name}: ${s.target.repo} on "${s.schedule}"`)
}
}
register().catch((err) => {
console.error(err)
process.exit(1)
})