Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions config/angular/blogs/audience.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"expertise": "BEGINNER",
"version": 1,
"source": "medium",
"authorIds": [
"garima_mehra"
],
"author": "garima mehra",
"title": "Test",
"link": "https://medium.com/@garima_mehra/audience",
"tags": [
"nlp",
"performance"
]
}
12 changes: 12 additions & 0 deletions config/angular/blogs/how-to-become-a-react-developer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"expertise": "INTERMEDIATE",
"version": 1,
"source": "other",
"authorIds": [],
"author": "S Swathi Dharshna",
"title": "How to become a REACT developer",
"link": "https://devdigest.hashnode.dev/how-to-become-a-react-developer",
"tags": [
"performance"
]
}
12 changes: 12 additions & 0 deletions config/angular/blogs/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"expertise": "BEGINNER",
"version": 1,
"source": "other",
"authorIds": [],
"author": "Garima Mehra",
"title": "Google Dev Library | What will you build?",
"link": "https://devlibrary.withgoogle.com/test",
"tags": [
"performance"
]
}
6 changes: 6 additions & 0 deletions config/authors/garima_mehra.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "Garima Mehra",
"bio": "",
"photoURL": "https://miro.medium.com/max/512/1*_JRKHW74BAXM0709iUIN0g.jpeg",
"mediumURL": "https://medium.com/@garima_mehra"
}
13 changes: 13 additions & 0 deletions config/cloud/blogs/@DEVELOPERDIGEST.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"expertise": "BEGINNER",
"version": 1,
"source": "other",
"authorIds": [],
"author": "Swathi Dharshna",
"title": "Developer Digest — Hashnode",
"link": "https://hashnode.com/@DEVELOPERDIGEST",
"tags": [
"containers",
"data-analytics"
]
}
12 changes: 12 additions & 0 deletions config/cloud/blogs/how-to-build-a-developer-resume-in-english.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"expertise": "INTERMEDIATE",
"version": 1,
"source": "other",
"authorIds": [],
"author": "S Swathi Dharshna",
"title": "How to Build a Developer Resume (in English)",
"link": "https://devdigest.hashnode.dev/how-to-build-a-developer-resume-in-english",
"tags": [
"databases"
]
}
14 changes: 14 additions & 0 deletions config/ml/blogs/2022-12-dev-library-letters-16th-issue.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"expertise": "BEGINNER",
"version": 1,
"source": "other",
"authorIds": [],
"author": "Swathi Dharshna",
"title": "Dev Library Letters: 16th Issue",
"link": "https://developers.googleblog.com/2022/12/dev-library-letters-16th-issue.html",
"tags": [
"web",
"face",
"segmentation"
]
}
2 changes: 1 addition & 1 deletion shared/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dist
dist
115 changes: 115 additions & 0 deletions shared/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"license": "Apache-2.0",
"devDependencies": {
"@google-cloud/pubsub": "^2.8.0",
"@sendgrid/mail": "^7.7.0",
"@types/node": "^16.3.1",
"@types/node-fetch": "^2.5.11",
"@types/open-graph-scraper": "^4.8.1",
Expand Down
38 changes: 38 additions & 0 deletions shared/scripts/advocu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import * as fs from "fs";
import fetch from "node-fetch";
import * as path from "path";
import sendgrid from "@sendgrid/mail";

import { BlogMetadata } from "../types/BlogMetadata";
import { RepoMetadata } from "../types/RepoMetadata";
Expand Down Expand Up @@ -90,6 +91,40 @@ interface Application {
tags: string[];
}

const sendAutomatedEmail = (email: string, firstName: string, lastName: string) => {
const sendGridKey = process.env.DEVLIBRARYKEY;
if (!sendGridKey) {
exitWithError("Error: must set 'SENDGRID_API_KEY' environment variable");
}
sendgrid.setApiKey(sendGridKey || "");

const text = "Dear " + firstName + ", Congratulations, your content has been published"
+ " on the Google Dev Library platform. You can view it in your Dev Library author profile"
+ "https://devlibrary.withgoogle.com/authors/" + firstName + lastName +
" As next steps, you can also: Subscribe to our newsletter to stay updated with the latest"
+ "projects added to Dev Library. Join the Dev Library authors' channel Google Developers"
+ " Online Discord public server to connect with other Dev Library authors."
+ " Share your success on social media using the hashtag #GoogleDevLibrary"

const html = `<p>Dear ${firstName},</p><br><p>Congratulations, your content has been publish on the <a href="http://devlibrary.withgoogle.com" target="_blank">Google Dev Library platform</a>. You can view it in your Dev Library author profile: https://devlibrary.withgoogle.com/authors/${firstName}${lastName}</p><br><p>As next steps, you can also:</p><br><ul><li><a href="https://forms.gle/chWDtT5sbxaE2knZ6" target="_blank">Subscribe</a> to our newsletter to stay updated with the latest projects added to Dev Library.</li><li><a href="https://discord.com/invite/AbwzvEqdCu" target="_blank">Join</a> the Dev Library authors’ channel Google Developers Online Discord public server to connect with other Dev Library authors.</li><li><b>Share your success</b> on social media using the hashtag #GoogleDevLibrary</li></ul><br><p>Happy contributing!</p><br><p>Regards,</p><p>Google Dev Library Team</p>`

const finalEmail = {
from: "library-google-dev@google.com",
to: email,
subject: "[Google Dev Library] Congratulations your content is live",
text: text,
html: html
}

sendgrid.send(finalEmail)
.then((response) => {
console.log('SendGrid Email sent: ' + response)
})
.catch((error) => {
console.error(error)
})
}

function assertNonEmpty<T>(arr: T[]): arr is NonEmptyArray<T> {
return arr.length > 0;
}
Expand Down Expand Up @@ -184,6 +219,7 @@ export async function main() {

console.log(`Adding ${product} repo ${projectUrl}`);
await addRepo(product, projectUrl, /* projectId= */ undefined, metadata);
await sendAutomatedEmail(a.email, a.firstName, a.lastName);
}

if (a.blogPost) {
Expand All @@ -199,13 +235,15 @@ export async function main() {
/* projectId= */ undefined,
metadata
);
await sendAutomatedEmail(a.email, a.firstName, a.lastName);
} else {
await addOtherBlog(
product,
projectUrl,
/* projectId= */ undefined,
metadata
);
await sendAutomatedEmail(a.email, a.firstName, a.lastName);
}
} catch (e) {
console.error(`Problem occurred when adding a project: ${e}`);
Expand Down