1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Sends an email with all the open PRs that have not had any activity
// for specified period of days
// Set up this function to run every day (or any interval)
export async function staleGithubPRsEmail() {
// Set up a secret named githubRepos with all the repos you want to analyze (comma separated)
let repos = me.secrets.githubRepos.split(",").filter((r) =>
r.trim()
);
let staleSinceDaysAgo = 3; // Any PR with no activity for this many days will qualify
let pullRequests = await ramkarthik.reposStaleGithubPRs(
repos,
me.secrets.githubOwner, // Set up a secret named githubOwner with the owner name
me.secrets.github, // Create GitHub token and set up this secret
staleSinceDaysAgo,
);
let { html, subject } = ramkarthik.prsEmail(
pullRequests,
staleSinceDaysAgo,
);
console.email({ html: html, subject: subject });
}
👆 This is a val. Vals are TypeScript snippets of code, written in the browser and run on our servers. Create scheduled functions, email yourself, and persist small pieces of data — all from the browser.