Avatar

@tzq

6 public vals
Joined January 15, 2023
1
2
3
4
5
import { monitoringGitHubRepository } from "https://esm.town/v/tzq/monitoringGitHubRepository";
export async function monitoringEventBus() {
monitoringGitHubRepository("tzq0301/eventbus");
}
1
2
3
4
5
import { monitoringGitHubRepository } from "https://esm.town/v/tzq/monitoringGitHubRepository";
export async function monitoringZSearch() {
monitoringGitHubRepository("2063436123/ZSearch");
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { sendLarkMessage } from "https://esm.town/v/tzq/sendLarkMessage";
import { lastPushedAtForRepositories } from "https://esm.town/v/tzq/lastPushedAtForRepositories";
import { getInformationOfTheGitHubReposiroty } from "https://esm.town/v/tzq/getInformationOfTheGitHubReposiroty";
export async function monitoringGitHubRepository(repository) {
return await getInformationOfTheGitHubReposiroty(repository)
.then((resp) => {
if (!lastPushedAtForRepositories[repository]) {
lastPushedAtForRepositories[repository] = "";
}
if (lastPushedAtForRepositories[repository] != resp.pushed_at) {
lastPushedAtForRepositories[repository] = resp.pushed_at;
return sendLarkMessage(`${repository} has been updated!`);
}
return "No updates";
});
}
1
2
3
4
5
6
7
8
9
10
11
12
13
import process from "node:process";
import { fetchJSON } from "https://esm.town/v/dvergin/fetchJSON?v=2";
export async function getInformationOfTheGitHubReposiroty(repository) {
return await fetchJSON(`https://api.github.com/repos/${repository}`, {
headers: {
Accept: "application/vnd.github+json",
Authorization: `Bearer ${process.env.githubToken}`,
"X-GitHub-Api-Version": "2022-11-28",
},
})
.then((resp) => resp);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { fetch } from "https://esm.town/v/std/fetch";
import process from "node:process";
export async function sendLarkMessage(message) {
return fetch(process.env.larkRobotUrl, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
msg_type: "text",
content: {
text: message,
},
}),
}).then((resp) => resp.json());
}
1
2
3
export function scu() {
return "Sichuan University";
}
Next