mirror of
https://github.com/Instadapp/boardroom-inc-protocol-Info.git
synced 2024-07-29 22:37:02 +00:00
feat: script and github action to aggregate all events into one place"
"
This commit is contained in:
parent
d050a043bc
commit
fad9f53778
6
.github/workflows/pr.yml
vendored
6
.github/workflows/pr.yml
vendored
|
@ -1,6 +1,5 @@
|
||||||
name: validate protocol info
|
name: validate protocol info
|
||||||
on:
|
on: pull_request
|
||||||
pull_request
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
validate-protocol-info:
|
validate-protocol-info:
|
||||||
|
@ -14,3 +13,6 @@ jobs:
|
||||||
|
|
||||||
- name: Validate
|
- name: Validate
|
||||||
run: yarn validate
|
run: yarn validate
|
||||||
|
|
||||||
|
- name: Aggregate Events
|
||||||
|
run: yarn aggregateEvents
|
||||||
|
|
1
allEvents.json
Normal file
1
allEvents.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
[{"title":"Community Call #1","url":"https://docs.google.com/forms/d/e/1FAIpQLSespwUvYs0teDWPeFTi7HKCfHS-i_0StaKahcPHi_Zh4BZzbw/viewform","date":"2021-05-14T15:00:00.000Z","protocol":"banklessvault"},{"title":"Weekly Planning Session","url":"https://calendar.google.com/calendar/u/0/r/eventedit/copy/NWk4Ymxna2l1dWhpa25ycWRnbmhrbWdmNWxfMjAyMTAyMTVUMTcwMDAwWiBncmVnQGluZGV4Y29vcC5jb20","date":"2021-02-15T17:00:00.000Z","protocol":"indexCoop"},{"title":"Org. Work Session","url":"https://calendar.google.com/calendar/u/0/r/eventedit/copy/MW1qaTNqZWJmZTlxYWxidWY1MmdoN3Z0ajVfMjAyMTAyMTdUMTkwMDAwWiBncmVnQGluZGV4Y29vcC5jb20","date":"2021-02-17T19:00:00.000Z","protocol":"indexCoop"},{"title":"Engineering Work Session","url":"https://calendar.google.com/calendar/u/0/r/eventedit/copy/N285MW85Ym1wMDA5bWswZTNhajZwM2h2cGFfMjAyMTAyMTdUMjEwMDAwWiBncmVnQGluZGV4Y29vcC5jb20","date":"2021-02-17T21:00:00.000Z","protocol":"indexCoop"},{"title":"Growth Work Session","url":"https://calendar.google.com/calendar/u/0/r/eventedit/copy/M3Jpcmk3dHBlMXM3bHFqbGNiNWV0cWVucnRfMjAyMTAyMThUMjAwMDAwWiBncmVnQGluZGV4Y29vcC5jb20","date":"2021-02-18T21:20:00.000Z","protocol":"indexCoop"},{"title":"Weekly Planning Session","url":"https://calendar.google.com/calendar/u/0/r/eventedit/copy/NWk4Ymxna2l1dWhpa25ycWRnbmhrbWdmNWxfMjAyMTAyMjJUMTcwMDAwWiBncmVnQGluZGV4Y29vcC5jb20","date":"2021-02-22T17:00:00.000Z","protocol":"indexCoop"},{"title":"Org. Work Session","url":"https://calendar.google.com/calendar/u/0/r/eventedit/copy/MW1qaTNqZWJmZTlxYWxidWY1MmdoN3Z0ajVfMjAyMTAyMjRUMTkwMDAwWiBncmVnQGluZGV4Y29vcC5jb20","date":"2021-02-24T19:00:00.000Z","protocol":"indexCoop"},{"title":"Engineering Work Session","url":"https://calendar.google.com/calendar/u/0/r/eventedit/copy/N285MW85Ym1wMDA5bWswZTNhajZwM2h2cGFfMjAyMTAyMjRUMjEwMDAwWiBncmVnQGluZGV4Y29vcC5jb20","date":"2021-02-24T21:00:00.000Z","protocol":"indexCoop"},{"title":"Growth Work Session","url":"https://calendar.google.com/calendar/u/0/r/eventedit/copy/M3Jpcmk3dHBlMXM3bHFqbGNiNWV0cWVucnRfMjAyMTAyMjVUMjAwMDAwWiBncmVnQGluZGV4Y29vcC5jb20","date":"2021-02-25T21:20:00.000Z","protocol":"indexCoop"},{"title":"Weekly Planning Session","url":"https://calendar.google.com/calendar/u/0/r/eventedit/copy/NWk4Ymxna2l1dWhpa25ycWRnbmhrbWdmNWxfMjAyMTAzMDFUMTcwMDAwWiBncmVnQGluZGV4Y29vcC5jb20","date":"2021-03-01T17:00:00.000Z","protocol":"indexCoop"},{"title":"Org. Work Session","url":"https://calendar.google.com/calendar/u/0/r/eventedit/copy/MW1qaTNqZWJmZTlxYWxidWY1MmdoN3Z0ajVfMjAyMTAzMDNUMTkwMDAwWiBncmVnQGluZGV4Y29vcC5jb20","date":"2021-03-03T19:00:00.000Z","protocol":"indexCoop"},{"title":"Engineering Work Session","url":"https://calendar.google.com/calendar/u/0/r/eventedit/copy/N285MW85Ym1wMDA5bWswZTNhajZwM2h2cGFfMjAyMTAzMDNUMjEwMDAwWiBncmVnQGluZGV4Y29vcC5jb20","date":"2021-03-03T21:00:00.000Z","protocol":"indexCoop"},{"title":"Growth Work Session","url":"https://calendar.google.com/calendar/u/0/r/eventedit/copy/M3Jpcmk3dHBlMXM3bHFqbGNiNWV0cWVucnRfMjAyMTAzMDRUMjAwMDAwWiBncmVnQGluZGV4Y29vcC5jb20","date":"2021-03-04T21:20:00.000Z","protocol":"indexCoop"},{"title":"Weekly Brainstorm ⛈","url":"https://calendar.google.com/calendar/u/0/r/eventedit/copy/Nm1icHFuaGNkbnN2azU2bzdldHZnNTVxYWpfMjAyMTAyMjVUMTgwMDAwWiBkNDY3a2E4aWpkamQ5Mzh1czMzcGhhbWNvc0Bn","date":"2021-02-25T18:00:00.000Z","protocol":"yup"},{"title":"Weekly Brainstorm ⛈","url":"https://calendar.google.com/calendar/u/0/r/eventedit/copy/Nm1icHFuaGNkbnN2azU2bzdldHZnNTVxYWpfMjAyMTAzMDRUMTgwMDAwWiBkNDY3a2E4aWpkamQ5Mzh1czMzcGhhbWNvc0Bn","date":"2021-03-04T18:00:00.000Z","protocol":"yup"},{"title":"Weekly Brainstorm ⛈","url":"https://calendar.google.com/calendar/u/0/r/eventedit/copy/Nm1icHFuaGNkbnN2azU2bzdldHZnNTVxYWpfMjAyMTAzMTFUMTgwMDAwWiBkNDY3a2E4aWpkamQ5Mzh1czMzcGhhbWNvc0Bn","date":"2021-03-11T18:00:00.000Z","protocol":"yup"}]
|
|
@ -28,6 +28,7 @@
|
||||||
"bulkAdd": "ts-node ./scripts/bulk_add.ts",
|
"bulkAdd": "ts-node ./scripts/bulk_add.ts",
|
||||||
"build": "ts-node ./scripts/build.ts && tsc -d",
|
"build": "ts-node ./scripts/build.ts && tsc -d",
|
||||||
"prepare": "yarn build",
|
"prepare": "yarn build",
|
||||||
|
"aggregateEvents": "yarn ./scripts/aggregate_events.ts",
|
||||||
"validate": "yarn build && ts-node ./scripts/validate.ts"
|
"validate": "yarn build && ts-node ./scripts/validate.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
56
scripts/aggregate_events.ts
Normal file
56
scripts/aggregate_events.ts
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
* Script to Aggregate the events for a protocol into a single events.json
|
||||||
|
* for few necessary requests on consumer end to get all manualy inputted events.
|
||||||
|
*
|
||||||
|
* N.B. this script should run in CI in order to make sure the amalgated events is
|
||||||
|
* always up to date, as we don't want community members to have to input their updates
|
||||||
|
* in more than one place.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import fs from "fs";
|
||||||
|
import path from "path";
|
||||||
|
|
||||||
|
interface Event {
|
||||||
|
title: string;
|
||||||
|
protocol: string;
|
||||||
|
url: string;
|
||||||
|
date: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const directoryPath = path.join(__dirname, "../protocols");
|
||||||
|
|
||||||
|
function aggregateEvents() {
|
||||||
|
// for each folder in ../src
|
||||||
|
const files = fs.readdirSync(directoryPath);
|
||||||
|
|
||||||
|
let allEvents: Event[] = [];
|
||||||
|
|
||||||
|
files.forEach(function (filename) {
|
||||||
|
// add a { protocol: cname } field for each entry
|
||||||
|
if (filename !== "__example") {
|
||||||
|
const file = fs.readFileSync(path.join(__dirname, `../protocols/${filename}/events.json`));
|
||||||
|
|
||||||
|
try {
|
||||||
|
const fileAsJson: any = JSON.parse(file.toString());
|
||||||
|
|
||||||
|
const info = fs.readFileSync(path.join(__dirname, `../protocols/${filename}/index.json`));
|
||||||
|
|
||||||
|
const cname = JSON.parse(info.toString()).cname;
|
||||||
|
|
||||||
|
fileAsJson.map((event: any) => {
|
||||||
|
event.protocol = cname;
|
||||||
|
|
||||||
|
console.log(event);
|
||||||
|
|
||||||
|
allEvents.push(event);
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.log("no events");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
fs.writeFileSync(path.join(__dirname, `../allEvents.json`), JSON.stringify(allEvents));
|
||||||
|
}
|
||||||
|
|
||||||
|
aggregateEvents();
|
Loading…
Reference in New Issue
Block a user