Skip to content

Commit a70767e

Browse files
committed
Fix
1 parent 2209c84 commit a70767e

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

config/packages/github_api.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ services:
5353
Github\Api\Issue\Timeline:
5454
factory: ['@Github\Api\Issue', timeline]
5555
calls:
56-
- [ configure ]
56+
- [configure]
5757

5858
Github\Api\PullRequest:
5959
factory: ['@Github\Client', api]

src/Api/Workflow/GithubWorkflowApi.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ public function __construct(ResultPager $resultPager, WorkflowRuns $workflowApi,
2525

2626
public function approveWorkflowsForPullRequest(Repository $repository, string $headRepository, string $headBranch): void
2727
{
28-
$result = $this->resultPager->fetchAllLazy($this->workflowApi, 'all', [$repository->getVendor(), $repository->getName(), [
28+
$runs = $this->resultPager->fetchAllLazy($this->workflowApi, 'all', [$repository->getVendor(), $repository->getName(), [
2929
'branch' => $headBranch,
3030
'status' => 'action_required',
3131
]]);
3232

33-
foreach ($result['workflow_runs'] as $run) {
33+
foreach ($runs as $run) {
3434
if ($headRepository === $run['head_repository']['full_name']) {
3535
$this->workflowApi->approve($repository->getVendor(), $repository->getName(), $run['id']);
3636
}

src/Subscriber/ApproveCiForNonContributors.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/**
1111
* Make sure CI is running for all PRs.
1212
*
13-
* @author Wouter de Jong <[email protected]>
13+
* @author Tobias Nyholm <[email protected]>
1414
*/
1515
class ApproveCiForNonContributors implements EventSubscriberInterface
1616
{
@@ -24,10 +24,9 @@ public function onPullRequest(GitHubEvent $event)
2424
}
2525

2626
$repository = $event->getRepository();
27-
$pullRequestNumber = $data['pull_request']['number'];
2827
$headRepository = $data['pull_request']['head']['repo']['full_name'];
2928
$headBranch = $data['pull_request']['head']['ref'];
30-
$this->workflowApi->approveWorkflowsForPullRequest($repository, $pullRequestNumber, $headRepository, $headBranch);
29+
$this->workflowApi->approveWorkflowsForPullRequest($repository, $headRepository, $headBranch);
3130

3231
$event->setResponseData(['approved_run' => true]);
3332
}

0 commit comments

Comments
 (0)