Skip to content

Commit 7995937

Browse files
committed
migrate the rest of the functions
1 parent 4708452 commit 7995937

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

functions/src/badge.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as functions from "firebase-functions/v2";
22
import { Octokit } from "@octokit/rest";
33
import * as util from "./util";
44

5-
export const SamScoreBadge = functions.https.onRequest(async (req, res) => {
5+
export const SamScoreBadge_v2 = functions.https.onRequest(async (req, res) => {
66
const org = req.query["org"] as string;
77
const repo = req.query["repo"] as string;
88

functions/src/index.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,21 @@ import {
4040
// See: https://firebase.google.com/docs/functions/writing-and-viewing-logs#console-log
4141
import * as flog from "firebase-functions/logger";
4242

43-
export { SaveOrganizationSnapshot, SaveRepoSnapshot } from "./snapshot";
43+
export { SaveOrganizationSnapshot_v2, SaveRepoSnapshot_v2 } from "./snapshot";
4444

4545
export {
46-
RepoIssueStatistics,
47-
GetRepoReport,
48-
GetRepoReportHTML,
49-
GetRepoTimeSeries,
46+
RepoIssueStatistics_v2,
47+
GetRepoReport_v2,
48+
GetRepoReportHTML_v2,
49+
GetRepoTimeSeries_v2,
5050
GetWeeklyReport,
51-
SaveWeeklyReport,
51+
SaveWeeklyReport_v2,
5252
GetWeeklyEmail,
53-
SendWeeklyEmail,
54-
SendWeeklyRepoEmails,
53+
SendWeeklyEmail_v2,
54+
SendWeeklyRepoEmails_v2,
5555
} from "./report";
5656

57-
export { SamScoreBadge } from "./badge";
57+
export { SamScoreBadge_v2 } from "./badge";
5858

5959
// Config
6060
const bot_config = config.BotConfig.getDefault();
@@ -89,7 +89,7 @@ const pr_handler = new pullrequests.PullRequestHandler(bot_config);
8989
// Handler for Cron jobs
9090
const cron_handler = new cron.CronHandler(gh_client, bot_config);
9191

92-
export const eventWebhook = functions.https.onRequest(
92+
export const eventWebhook_v2 = functions.https.onRequest(
9393
util.FUNCTION_OPTS,
9494
async (request, response) => {
9595
const type = request.get("X-GitHub-Event");
@@ -123,7 +123,7 @@ export const eventWebhook = functions.https.onRequest(
123123
/**
124124
* Function that responds to GitHub events (HTTP webhook).
125125
*/
126-
export const githubWebhook = functions.https.onRequest(
126+
export const githubWebhook_v2 = functions.https.onRequest(
127127
util.FUNCTION_OPTS,
128128
async (request, response) => {
129129
// Get event and action;
@@ -279,7 +279,7 @@ export const githubWebhook = functions.https.onRequest(
279279
/**
280280
* Function that responds to pubsub events sent via an AppEngine cronjob.
281281
*/
282-
export const botCleanup = functions.scheduler.onSchedule(
282+
export const botCleanup_v2 = functions.scheduler.onSchedule(
283283
"every day 18:00",
284284
async () => {
285285
console.log("The cleanup job is running!");
@@ -447,7 +447,7 @@ async function executeAction(action: types.Action): Promise<any> {
447447
/**
448448
* Manually run this function to create tables.
449449
*/
450-
export const ensureBigquery = functions.pubsub.onMessagePublished(
450+
export const ensureBigquery_v2 = functions.pubsub.onMessagePublished(
451451
"ensure-bigquery",
452452
async () => {
453453
const repos = bot_config.getAllRepos();

functions/src/report.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ export async function MakeRepoTimeSeries(
493493
/**
494494
* HTTP function for experimenting with a new SAM score.
495495
*/
496-
export const RepoIssueStatistics = functions.https.onRequest(
496+
export const RepoIssueStatistics_v2 = functions.https.onRequest(
497497
util.FUNCTION_OPTS,
498498
async (req, res) => {
499499
const org = (req.query["org"] as string) || "firebase";
@@ -511,7 +511,7 @@ export const RepoIssueStatistics = functions.https.onRequest(
511511
/**
512512
* HTTP Function to get a JSON report on a repo.
513513
*/
514-
export const GetRepoReport = functions.https.onRequest(
514+
export const GetRepoReport_v2 = functions.https.onRequest(
515515
util.FUNCTION_OPTS,
516516
async (req, res) => {
517517
// TODO: Allow passing in the 'start' date to get historical data.
@@ -535,7 +535,7 @@ export const GetRepoReport = functions.https.onRequest(
535535
/**
536536
* Preview the email for a repo
537537
*/
538-
export const GetRepoReportHTML = functions.https.onRequest(
538+
export const GetRepoReportHTML_v2 = functions.https.onRequest(
539539
util.FUNCTION_OPTS,
540540
async (req, res) => {
541541
const org = (req.query["org"] as string) || "firebase";
@@ -557,7 +557,7 @@ export const GetRepoReportHTML = functions.https.onRequest(
557557
/**
558558
* HTTP Function to get a JSON report on a repo.
559559
*/
560-
export const GetRepoTimeSeries = functions.https.onRequest(
560+
export const GetRepoTimeSeries_v2 = functions.https.onRequest(
561561
util.FUNCTION_OPTS,
562562
async (req, res) => {
563563
// CORS-hack
@@ -597,7 +597,7 @@ export const GetRepoTimeSeries = functions.https.onRequest(
597597
/**
598598
* PubSub function that saves the weekly report to RTDB.
599599
*/
600-
export const SaveWeeklyReport = functions.scheduler.onSchedule(
600+
export const SaveWeeklyReport_v2 = functions.scheduler.onSchedule(
601601
"every wednesday 09:00",
602602
async () => {
603603
const now = new Date();
@@ -615,7 +615,7 @@ export const SaveWeeklyReport = functions.scheduler.onSchedule(
615615
/**
616616
* PubSub function that sends the GitHub email based on the latest weekly report.
617617
*/
618-
export const SendWeeklyEmail = functions.scheduler.onSchedule(
618+
export const SendWeeklyEmail_v2 = functions.scheduler.onSchedule(
619619
"every wednesday 09:30",
620620
async () => {
621621
const emailText = await GetWeeklyEmail("firebase");
@@ -631,7 +631,7 @@ export const SendWeeklyEmail = functions.scheduler.onSchedule(
631631
/**
632632
* PubSub function that sends the GitHub email based on the latest weekly report.
633633
*/
634-
export const SendWeeklyRepoEmails = functions.scheduler.onSchedule(
634+
export const SendWeeklyRepoEmails_v2 = functions.scheduler.onSchedule(
635635
"every wednesday 10:00",
636636
async () => {
637637
const allRepos = bot_config.getAllRepos();

functions/src/snapshot.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export async function FetchRepoSnapshot(
204204
return data;
205205
}
206206

207-
export const SaveRepoSnapshot = functions.pubsub.onMessagePublished(
207+
export const SaveRepoSnapshot_v2 = functions.pubsub.onMessagePublished(
208208
"repo_snapshot",
209209
async (event) => {
210210
// Date for ingestion
@@ -301,7 +301,7 @@ export const SaveRepoSnapshot = functions.pubsub.onMessagePublished(
301301
},
302302
);
303303

304-
export const SaveOrganizationSnapshot = functions.scheduler.onSchedule(
304+
export const SaveOrganizationSnapshot_v2 = functions.scheduler.onSchedule(
305305
"every day 12:00",
306306
async () => {
307307
const configRepos = bot_config.getAllRepos();

0 commit comments

Comments
 (0)