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

Merge release 1.12.1 into 1.13.x #141

Merged
merged 8 commits into from
May 23, 2021
Merged
Show file tree
Hide file tree
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
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,26 @@ All notable changes to this project will be documented in this file, in reverse

- Nothing.


## 1.12.1 - 2021-05-23


-----

### Release Notes for [1.12.1](https://github.com/laminas/automatic-releases/milestone/32)

1.12.x bugfix release (patch)

### 1.12.1

- Total issues resolved: **1**
- Total pull requests resolved: **1**
- Total contributors: **1**

#### Bug

- [140: Private repository release support](https://github.com/laminas/automatic-releases/pull/140) thanks to @Lansoweb

## 1.12.0 - 2021-05-21


Expand Down
4 changes: 3 additions & 1 deletion bin/console.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace Laminas\AutomaticReleases\WebApplication;

use ChangelogGenerator\GitHubOAuthToken;
use DateTimeZone;
use ErrorException;
use Http\Discovery\HttpClientDiscovery;
Expand Down Expand Up @@ -86,7 +87,8 @@ static function (int $errorCode, string $message = '', string $file = '', int $l
);
$createCommitText = new CreateReleaseTextThroughChangelog(JwageGenerateChangelog::create(
$makeRequests,
$httpClient
$httpClient,
new GitHubOAuthToken($githubToken)
));
$createReleaseText = new MergeMultipleReleaseNotes([
new CreateReleaseTextViaKeepAChangelog($changelogExists, new SystemClock(new DateTimeZone('UTC'))),
Expand Down
13 changes: 9 additions & 4 deletions src/Github/JwageGenerateChangelog.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use ChangelogGenerator\ChangelogConfig;
use ChangelogGenerator\ChangelogGenerator;
use ChangelogGenerator\GitHubCredentials;
use ChangelogGenerator\IssueClient;
use ChangelogGenerator\IssueFactory;
use ChangelogGenerator\IssueFetcher;
Expand All @@ -20,23 +21,26 @@
final class JwageGenerateChangelog implements GenerateChangelog
{
private ChangelogGenerator $changelogGenerator;
private GitHubCredentials $gitHubCredentials;

public function __construct(ChangelogGenerator $changelogGenerator)
public function __construct(ChangelogGenerator $changelogGenerator, GitHubCredentials $gitHubCredentials)
{
$this->changelogGenerator = $changelogGenerator;
$this->gitHubCredentials = $gitHubCredentials;
}

public static function create(
RequestFactoryInterface $messageFactory,
ClientInterface $client
ClientInterface $client,
GitHubCredentials $gitHubCredentials
): self {
$issueClient = new IssueClient($messageFactory, $client);
$issueFactory = new IssueFactory();
$issueFetcher = new IssueFetcher($issueClient);
$issueRepository = new IssueRepository($issueFetcher, $issueFactory);
$issueGrouper = new IssueGrouper();

return new self(new ChangelogGenerator($issueRepository, $issueGrouper));
return new self(new ChangelogGenerator($issueRepository, $issueGrouper), $gitHubCredentials);
}

public function __invoke(
Expand All @@ -46,7 +50,8 @@ public function __invoke(
$config = (new ChangelogConfig())
->setUser($repositoryName->owner())
->setRepository($repositoryName->name())
->setMilestone($semVerVersion->fullReleaseName());
->setMilestone($semVerVersion->fullReleaseName())
->setGitHubCredentials($this->gitHubCredentials);

$output = new BufferedOutput();

Expand Down
26 changes: 24 additions & 2 deletions test/unit/Github/JwageGenerateChangelogTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,27 @@

use ChangelogGenerator\ChangelogConfig;
use ChangelogGenerator\ChangelogGenerator;
use ChangelogGenerator\GitHubCredentials;
use ChangelogGenerator\GitHubOAuthToken;
use Http\Client\HttpClient;
use Laminas\AutomaticReleases\Git\Value\SemVerVersion;
use Laminas\AutomaticReleases\Github\JwageGenerateChangelog;
use Laminas\AutomaticReleases\Github\Value\RepositoryName;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\RequestFactoryInterface;
use Symfony\Component\Console\Output\BufferedOutput;

final class JwageGenerateChangelogTest extends TestCase
{
public function testGenerateChangelog(): void
{
$githubCredentials = new GitHubOAuthToken('token');

$config = (new ChangelogConfig())
->setUser('laminas')
->setRepository('repository-name')
->setMilestone('1.0.0');
->setMilestone('1.0.0')
->setGitHubCredentials($githubCredentials);

$output = new BufferedOutput();

Expand All @@ -32,7 +39,22 @@ public function testGenerateChangelog(): void
$repositoryName = RepositoryName::fromFullName('laminas/repository-name');
$semVerVersion = SemVerVersion::fromMilestoneName('1.0.0');

(new JwageGenerateChangelog($changelogGenerator))
(new JwageGenerateChangelog($changelogGenerator, $githubCredentials))
->__invoke($repositoryName, $semVerVersion);
}

public function testCreateGenerateChangelog(): void
{
$makeRequests = $this->createMock(RequestFactoryInterface::class);
$httpClient = $this->createMock(HttpClient::class);
$githubToken = $this->createMock(GitHubCredentials::class);

$changeLogGenerator = JwageGenerateChangelog::create(
$makeRequests,
$httpClient,
$githubToken
);

$this->assertInstanceOf(JwageGenerateChangelog::class, $changeLogGenerator);
}
}