Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send error to queue #163

Merged
merged 2 commits into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Src/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@
require_once "lib/request.php";
require_once "lib/appveyor.php";
require_once "lib/github.php";
require_once "lib/queue.php";

Check warning on line 47 in Src/config/config.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

Src/config/config.php#L47

"require_once" statement detected. File manipulations are discouraged.
8 changes: 7 additions & 1 deletion Src/lib/github.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@
$baseUrl = "https://api.github.com/";
$url = $baseUrl . $url;

return doRequest($url, $gitHubToken, $data);
$response = doRequest($url, $gitHubToken, $data);

if($response["status"] >= 300) {

Check notice on line 16 in Src/lib/github.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

Src/lib/github.php#L16

Expected "if (...) {\n"; found "if(...) {\n"

Check notice on line 16 in Src/lib/github.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

Src/lib/github.php#L16

Expected 1 space(s) after IF keyword; 0 found
sendQueue("github.error", array("url" => $url, "data" => $data), $response);

Check notice on line 17 in Src/lib/github.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

Src/lib/github.php#L17

Short array syntax must be used to define arrays
}

return $response;
}

function generateAppToken()
Expand Down
6 changes: 2 additions & 4 deletions Src/pullRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,10 @@ function handlePullRequest($pullRequest)
$issueResponse = requestGitHub($metadata["token"], $metadata["issuesUrl"] . "/" . $issueNumber);

$labels = array_column(json_decode($issueResponse["body"])->labels, "name");
echo "Labels: \n";
print_r($labels);
$body = array("labels" => array("WIP"));
requestGitHub($metadata["token"], $metadata["issuesUrl"] . "/" . $issueNumber . "/labels", $labels);
requestGitHub($metadata["token"], $metadata["issuesUrl"] . "/" . $issueNumber . "/labels", $body);
$body = array("labels" => $labels);
requestGitHub($metadata["token"], $metadata["prLabelsUrl"] . "/labels", $labels);
requestGitHub($metadata["token"], $metadata["prLabelsUrl"] . "/labels", $body);
}

if (!$botReviewed) {
Expand Down
Loading