Skip to content

Commit

Permalink
Removed createLabels method (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
M97Chahboun committed Mar 23, 2023
1 parent 462e305 commit ad7f718
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions lib/src/utils/github_snitch_instance.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ class GhSnitchInstance {
int? milestone}) async {
bool connected = await isConnected;
if (connected) {
await createLabel(externalIssueLabel,
"Errors not caught by Flutter Framework", "f0c2dd");
await createLabel(
internalIssueLabel, "Errors caught by Flutter Framework", "6a4561");
await createLabel(fromGhRSnitchPackage,
"Errors caught by Github Snitch package", "970206");
String issueEndpoint = "$owner/$repo/issues";
bool notCreated = await issueIsNew(body, issueEndpoint);
if (notCreated) {
Expand Down Expand Up @@ -173,32 +167,6 @@ class GhSnitchInstance {
return Future.value(false);
}

Future<void> createLabel(
String label, String description, String color) async {
bool labelNotCreated = !(await Prefs.checkIfExist(label));
if (labelNotCreated) {
String labelEndpoint = "$owner/$repo/labels";
Map labelBody = {
"name": label,
"description": description,
"color": color
};
String labelBodyToString = json.encode(labelBody);
GhResponse response =
await ghRequest.request("POST", labelEndpoint, labelBodyToString);
if (response.statusCode == 201 ||
response.response["errors"][0]["code"] == "already_exists") {
log("✅ $label Label Created");
Prefs.setLabel(label, true);
} else {
log("❌ Echec to Create $label Label");
log(response.response.toString());
}
} else {
log("✅ $label Label Already Created");
}
}

Future<bool> issueIsNew(String body, String endpoint) async {
String params = "?state=all&labels=$fromGhRSnitchPackage";
GhResponse ghResponse =
Expand Down

0 comments on commit ad7f718

Please sign in to comment.