forked from NeoDAOWeb3/digital-readiness-assessment
-
Notifications
You must be signed in to change notification settings - Fork 1
/
process_manifest.js
42 lines (36 loc) · 1002 Bytes
/
process_manifest.js
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
import { readCSV } from "https://deno.land/x/[email protected]/mod.ts";
const inputFilename = "data_manifest.csv";
const outputFilename = ".github/workflows/flat.yml";
const manifest = await readCSV(inputFilename);
const steps = manifest.map(
({ name, format, endpoint }) => `
- name: Fetch data
uses: githubocto/flat@v2
if: always()
with:
http_url: ${endpoint}
downloaded_filename: data/${name}.${format}
postprocess: ./process_raw_data.js
`
);
const top = `name: data
on:
schedule:
- cron: 0 0 13 * *
workflow_dispatch: {}
push:
paths:
- .github/workflows/flat.yml
- ./process_xlsx.js
jobs:
scheduled:
runs-on: ubuntu-latest
steps:
- name: Setup deno
uses: denoland/setup-deno@main
with:
deno-version: v1.x
- name: Check out repo
uses: actions/checkout@v2`;
const yamlString = top + steps.join("");
await Deno.writeTextFile(outputFilename, yamlString);