Skip to content

Commit 40aefb0

Browse files
committed
Add basic workflow construction
1 parent efe64e0 commit 40aefb0

1 file changed

Lines changed: 40 additions & 2 deletions

File tree

pr-checks/sync.ts

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,47 @@ function main(): void {
151151

152152
console.log(`Processing: ${checkName} — "${checkSpecification.name}"`);
153153

154-
// For now, write a placeholder workflow file.
154+
let workflowInputs: Record<string, WorkflowInput> = {};
155+
if (checkSpecification.inputs) {
156+
workflowInputs = checkSpecification.inputs;
157+
}
158+
159+
const workflow = {
160+
name: `PR Check - ${checkSpecification.name}`,
161+
env: {
162+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}",
163+
GO111MODULE: "auto",
164+
},
165+
on: {
166+
push: {
167+
branches: ["main", "releases/v*"],
168+
},
169+
pull_request: {
170+
types: ["opened", "synchronize", "reopened", "ready_for_review"],
171+
},
172+
merge_group: {
173+
types: ["checks_requested"],
174+
},
175+
schedule: [{ cron: "0 5 * * *" }],
176+
workflow_dispatch: {
177+
inputs: workflowInputs,
178+
},
179+
workflow_call: {
180+
inputs: workflowInputs,
181+
},
182+
},
183+
defaults: {
184+
run: {
185+
shell: "bash",
186+
},
187+
},
188+
jobs: {
189+
[checkName]: checkJob,
190+
},
191+
};
192+
155193
const outputPath = path.join(OUTPUT_DIR, `__${checkName}.yml`);
156-
writeYaml(outputPath, {});
194+
writeYaml(outputPath, workflow);
157195
}
158196

159197
console.log(

0 commit comments

Comments
 (0)