Skip to content

Commit e48abea

Browse files
committed
Update: GitHub actions for new collection
1 parent 342412b commit e48abea

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

publish/index.js

+22
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,24 @@ async function main() {
6262
}
6363

6464
const fileNameWithoutExtension = projectMdxFile.split(".")[0];
65+
6566
const projectExists = (
6667
await firestore.collection("projects").doc(fileNameWithoutExtension).get()
6768
).exists;
6869

70+
const projectReactionsExists = (
71+
await firestore
72+
.collection("projectReactions")
73+
.doc(fileNameWithoutExtension)
74+
.get()
75+
).exists;
76+
77+
if (!projectReactionsExists) {
78+
await createProjectReactionsDoc({
79+
projectName: fileNameWithoutExtension,
80+
});
81+
}
82+
6983
const projectContent = fs.readFileSync(
7084
path.resolve(
7185
process.cwd(),
@@ -167,3 +181,11 @@ async function main() {
167181
}
168182
}
169183
}
184+
185+
async function createProjectReactionsDoc({ projectName }) {
186+
await firestore.collection("projectReactions").doc(projectName).set({
187+
likes: 0,
188+
shares: 0,
189+
bookmarks: 0,
190+
});
191+
}

0 commit comments

Comments
 (0)