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

Update labels #158

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Changes from all commits
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
17 changes: 15 additions & 2 deletions Src/pullRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"assigneesUrl" => "repos/" . $pullRequest->RepositoryOwner . "/" . $pullRequest->RepositoryName . "/issues/" . $pullRequest->Number . "/assignees",
"collaboratorsUrl" => "repos/" . $pullRequest->RepositoryOwner . "/" . $pullRequest->RepositoryName . "/collaborators",
"requestReviewUrl" => "repos/" . $pullRequest->RepositoryOwner . "/" . $pullRequest->RepositoryName . "/issues/" . $pullRequest->Number . "/requested_reviewers",
"issuesUrl" => "repos/" . $pullRequest->RepositoryOwner . "/" . $pullRequest->RepositoryName . "/issues",
"prLabelsUrl" => "repos/" . $pullRequest->RepositoryOwner . "/" . $pullRequest->RepositoryName . "/issues/" . $pullRequest->Number . "/labels"
);

$pullRequestResponse = requestGitHub($metadata["token"], $metadata["pullRequestUrl"]);
Expand Down Expand Up @@ -81,8 +83,19 @@
}"
);

$referencedIssue = requestGitHub($metadata["token"], "graphql", $referencedIssueQuery);
print_r($referencedIssue["body"]);
$referencedIssueResponse = requestGitHub($metadata["token"], "graphql", $referencedIssueQuery);

Check notice on line 86 in Src/pullRequests.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

Src/pullRequests.php#L86

Avoid excessively long variable names like $referencedIssueResponse. Keep variable name length under 20.
$referencedIssue = json_decode($referencedIssueResponse["body"]);
if (count($referencedIssue->data->repository->pullRequest->closingIssuesReferences->nodes) > 0) {
$issueNumber = $referencedIssue->data->repository->pullRequest->closingIssuesReferences->nodes[0]->number;
$issueResponse = requestGitHub($metadata["token"], $metadata["issuesUrl"] . "/" . $issueNumber);

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

Check notice on line 98 in Src/pullRequests.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

Src/pullRequests.php#L98

Whitespace found at end of line

if (!$botReviewed) {
$body = array("event" => "APPROVE");
Expand Down
Loading