Skip to content

Commit

Permalink
jo was nd
Browse files Browse the repository at this point in the history
  • Loading branch information
stevan06v committed Mar 28, 2024
1 parent 93731df commit 645d072
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/Traits/RepositoryCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ trait RepositoryCollector
public function collect_repositories(Monitor $monitor)
{
// milestones
$url = $_ENV['APP_SERVICE_URL'] . '/v1/github/orgs/' . $monitor->organization_name . '/projects/' . $monitor->project_identification . '/repositories/milestones/issues' . "?rootPageSize=10&milestonesPageSize=100&issuesPageSize=100&issues_states=open,closed";
$url = $_ENV['APP_SERVICE_URL'] . '/v1/github/orgs/' . $monitor->organization_name . '/projects/' . $monitor->project_identification . '/repositories/milestones/issues' . "?rootPageSize=10&milestonesPageSize=10&issuesPageSize=100&issues_states=open,closed";

try {
$response = Http::withHeaders([
Expand All @@ -33,14 +33,13 @@ public function collect_repositories(Monitor $monitor)
if ($response->successful()) {

$repositories = $response->json()['data']['organization']['projectV2']['repositories']['nodes'];

$monitor->repositories()->delete();

foreach ($repositories as $repositoryData) {

$repository = new Repository();

$repository->name = $repositoryData["name"];
$repository->name = "";

$get_repository = $monitor->repositories()->save($repository); // Save the repository

Expand All @@ -66,7 +65,7 @@ public function collect_repositories(Monitor $monitor)
}
return Repository::where("monitor_id", "=", $monitor->id)->get();
} else {
throw new Exception("Looks like you ran out of tokens for " . $monitor->title . "!");
throw new Exception("Looks like you ran out of tokens for " . $monitor->title . "! " . $response->body() );
}
}
}

0 comments on commit 645d072

Please sign in to comment.