aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorbraxtonhall2022-10-24 19:18:35 +0000
committerbraxtonhall2022-10-24 19:18:35 +0000
commit7cdf8b8dfca8e8513fdbc1ed67a701420d8527cb (patch)
tree47a9d83e449d9ec8791048da70149ce25530ef92 /bin
parent7972ad88012a56f6afd54ada46cd45206418682a (diff)
Add a PR workflow
Diffstat (limited to 'bin')
-rw-r--r--bin/checkPeople.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/bin/checkPeople.js b/bin/checkPeople.js
new file mode 100644
index 0000000..60527b9
--- /dev/null
+++ b/bin/checkPeople.js
@@ -0,0 +1,29 @@
+const fs = require("fs");
+
+const PEOPLE_PATH = "./people.json";
+
+const [actor] = process.argv.slice(2);
+
+console.log(`Triggered by ${actor}`);
+
+if (!fs.existsSync(PEOPLE_PATH)) {
+ throw "No people file found";
+}
+
+let people;
+try {
+ people = JSON.parse(fs.readFileSync(PEOPLE_PATH));
+} catch (err) {
+ throw "Could not read people.json as JSON";
+}
+
+const person = people.find(person => person.github === actor);
+if (!person) {
+ throw `${actor} isn't in people.json!`;
+}
+
+if (!(person.entries && person.entries.length > 0)) {
+ throw `${actor} is missing entries!`;
+}
+
+console.log("Checked!");