Skip to content

Commit

Permalink
✨ Update repo description, topics, homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Oct 29, 2020
1 parent 5d99ba3 commit f572ab1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ export interface UpptimeConfig {
introMessage?: string;
navbar?: { title: string; url: string }[];
};
skipDescriptionUpdate?: boolean;
skipTopicsUpdate?: boolean;
skipHomepageUpdate?: boolean;
}
27 changes: 26 additions & 1 deletion src/summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@ ${pageStatuses
if (readmeContent.includes("<!--start: logo-->"))
readmeContent = `${logoStartText}${logoEndText}`;

let name = `[${config.owner}](${website})`;
if (
readmeContent.includes("[MIT](./LICENSE) © [Koj](https://koj.co)") ||
readmeContent.includes("<!--start: description-->")
) {
let name = `[${config.owner}](${website})`;
try {
const org = await octokit.users.getByUsername({ username: config.owner });
name = `[${org.data.name || config.owner}](${org.data.blog || website})`;
Expand All @@ -180,6 +180,31 @@ ${pageStatuses
new RegExp("upptime/upptime/workflows", "g"),
`${config.owner}/${config.repo}/workflows`
);

// Add repo description, topics, etc.
try {
const repoInfo = await octokit.repos.get({ owner, repo });
if (!repoInfo.data.description && !config.skipDescriptionUpdate)
await octokit.repos.update({
owner,
repo,
description: `📈 Uptime monitor and status page for ${name
.split("]")[0]
.replace("[", "")}, powered by @upptime`,
});
if (!repoInfo.data.topics.length && !config.skipTopicsUpdate)
await octokit.repos.replaceAllTopics({
owner,
repo,
names: ["uptime-monitor", "status-page", "upptime"],
});
if (!repoInfo.data.homepage && !config.skipHomepageUpdate)
await octokit.repos.update({
owner,
repo,
homepage: website,
});
} catch (error) {}
}

// Add live status line
Expand Down

0 comments on commit f572ab1

Please sign in to comment.