This repository has been archived by the owner on Oct 18, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: issue and default branch check
- Loading branch information
1 parent
1a236ef
commit f0b19c1
Showing
3 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export default function defaultBranch(repo) { | ||
const defaultBranchName = "main"; | ||
|
||
let response = { | ||
id: "defaultBranch", | ||
href: "/repo/status", | ||
title: "Default Branch", | ||
}; | ||
|
||
if (repo.default_branch === defaultBranchName) { | ||
response.status = "success"; | ||
response.description = "You are using the recommend default branch name."; | ||
response.extra = "No action required."; | ||
} | ||
|
||
if (!repo.default_branch !== defaultBranchName) { | ||
response.status = "warning"; | ||
response.description = | ||
"You are not using the recommended default branch name."; | ||
response.extra = "This may confuse contributors on your project."; | ||
} | ||
|
||
return response; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
export default function issues(repo) { | ||
const min = 5; | ||
const max = 20; | ||
|
||
let response = { | ||
id: "issues", | ||
href: "/repo/status", | ||
title: "Issue", | ||
}; | ||
|
||
if (repo.open_issues > max) { | ||
response.status = "success"; | ||
response.description = "You have open issues."; | ||
response.extra = "No action required."; | ||
} | ||
|
||
if (repo.open_issues >= min && repo.open_issues <= max) { | ||
response.status = "warning"; | ||
response.description = "You have some open issues."; | ||
response.extra = "Are there any bugs or features ideas you have?"; | ||
} | ||
|
||
if (repo.open_issues < min) { | ||
response.status = "error"; | ||
response.description = "There are not enough open issues."; | ||
response.extra = | ||
"Try creating some more, or asking the community for ideas."; | ||
} | ||
|
||
return response; | ||
} |