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

Fix release markdown rendering of double newlines #176

Closed
glensc opened this issue Jan 16, 2022 · 10 comments · May be fixed by #177
Closed

Fix release markdown rendering of double newlines #176

glensc opened this issue Jan 16, 2022 · 10 comments · May be fixed by #177
Assignees
Labels
Bug Something isn't working

Comments

@glensc
Copy link
Contributor

glensc commented Jan 16, 2022

Bug Report

Q A
Version(s) v1

Summary

Because there's a double newline between two lists, markdown renders every item with double newlines and considers the two lists as one.

The workaround is to put some non-list element between the lists.

Current behavior

image

markdown source
### Release Notes for [0.19.1](https://github.com/perftools/xhgui/milestone/19)

0.19.x bugfix release (patch)

### 0.19.1

- Total issues resolved: **0**
- Total pull requests resolved: **4**
- Total contributors: **2**

 - [442: Cleanup:  Remove adding ext-phar for build in Dockerfile](https://github.com/perftools/xhgui/pull/442) thanks to @glensc
 - [441: Set GIT_AUTHOR_NAME/GIT_AUTHOR_EMAIL via env rather secrets](https://github.com/perftools/xhgui/pull/441) thanks to @glensc
 - [438: Feature: Add driver name to PdoRepository](https://github.com/perftools/xhgui/pull/438) thanks to @glensc
 - [436: Implement pdo: getForUrl(), getPercentileForUrl(), getAll()](https://github.com/perftools/xhgui/pull/436) thanks to @fengqi

Expected behavior

image

markdown source
### Release Notes for [0.19.1](https://github.com/perftools/xhgui/milestone/19)

0.19.x bugfix release (patch)

### 0.19.1

Summary:
- Total issues resolved: **0**
- Total pull requests resolved: **4**
- Total contributors: **2**

Pull requests:
 - [442: Cleanup:  Remove adding ext-phar for build in Dockerfile](https://github.com/perftools/xhgui/pull/442) thanks to @glensc
 - [441: Set GIT_AUTHOR_NAME/GIT_AUTHOR_EMAIL via env rather secrets](https://github.com/perftools/xhgui/pull/441) thanks to @glensc
 - [438: Feature: Add driver name to PdoRepository](https://github.com/perftools/xhgui/pull/438) thanks to @glensc
 - [436: Implement pdo: getForUrl(), getPercentileForUrl(), getAll()](https://github.com/perftools/xhgui/pull/436) thanks to @fengqi

@glensc glensc added the Bug Something isn't working label Jan 16, 2022
@glensc
Copy link
Contributor Author

glensc commented Jan 18, 2022

If you don't want to make changes to markdown formatting, is there a way to customize this in project I use?

@Ocramius
Copy link
Member

Ocramius commented Jan 18, 2022

IIRC, the markdown is generated by https://github.com/jwage/changelog-generator

To customize the release text, you would implement CreateReleaseText yourself:

interface CreateReleaseText
{
/**
* @psalm-param non-empty-string $repositoryDirectory
*/
public function __invoke(
Milestone $milestone,
RepositoryName $repositoryName,
SemVerVersion $semVerVersion,
BranchName $sourceBranch,
string $repositoryDirectory
): ChangelogReleaseNotes;
/** @psalm-param non-empty-string $repositoryDirectory */
public function canCreateReleaseText(
Milestone $milestone,
RepositoryName $repositoryName,
SemVerVersion $semVerVersion,
BranchName $sourceBranch,
string $repositoryDirectory
): bool;
}

Then inject it in the command:

public function __construct(
Variables $environment,
LoadCurrentGithubEvent $loadEvent,
Fetch $fetch,
GetMergeTargetCandidateBranches $getMergeTargets,
GetGithubMilestone $getMilestone,
CommitReleaseChangelog $commitChangelog,
CreateReleaseText $createChangelogText,
CreateTag $createTag,
Push $push,
CreateRelease $createRelease
) {
parent::__construct('laminas:automatic-releases:release');
$this->environment = $environment;
$this->loadEvent = $loadEvent;
$this->fetch = $fetch;
$this->getMergeTargets = $getMergeTargets;
$this->getMilestone = $getMilestone;
$this->commitChangelog = $commitChangelog;
$this->createChangelogText = $createChangelogText;
$this->createTag = $createTag;
$this->push = $push;
$this->createRelease = $createRelease;
}

This is probably best done by having your own bin/console replacement:

(static function (): void {
require_once __DIR__ . '/../vendor/autoload.php';
set_error_handler(
static function (int $errorCode, string $message = '', string $file = '', int $line = 0): bool {
throw new ErrorException($message, 0, $errorCode, $file, $line);
},
E_STRICT | E_NOTICE | E_WARNING
);
$variables = EnvironmentVariables::fromEnvironment(new ImportGpgKeyFromStringViaTemporaryFile());
$logger = new Logger('automatic-releases');
$logger->pushHandler(new StreamHandler(STDERR, $variables->logLevel()));
$loadEvent = new LoadCurrentGithubEventFromGithubActionPath($variables);
$fetch = new FetchAndSetCurrentUserByReplacingCurrentOriginRemote($variables);
$getCandidateBranches = new GetMergeTargetCandidateBranchesFromRemoteBranches();
$makeRequests = Psr17FactoryDiscovery::findRequestFactory();
$httpClient = HttpClientDiscovery::find();
$githubToken = $variables->githubToken();
$getMilestone = new GetMilestoneFirst100IssuesAndPullRequests(new RunGraphQLQuery(
$makeRequests,
$httpClient,
$githubToken
));
$changelogExists = new ChangelogExistsViaConsole();
$checkoutBranch = new CheckoutBranchViaConsole();
$commit = new CommitFileViaConsole();
$push = new PushViaConsole();
$commitChangelog = new CommitReleaseChangelogViaKeepAChangelog(
$changelogExists,
$checkoutBranch,
$commit,
$push,
$logger
);
$createCommitText = new CreateReleaseTextThroughChangelog(JwageGenerateChangelog::create(
$makeRequests,
$httpClient,
new GitHubOAuthToken($githubToken)
));
$createReleaseText = new MergeMultipleReleaseNotes([
new CreateReleaseTextViaKeepAChangelog($changelogExists, new SystemClock(new DateTimeZone('UTC'))),
$createCommitText,
]);
$createRelease = new CreateReleaseThroughApiCall(
$makeRequests,
$httpClient,
$githubToken
);
$bumpChangelogVersion = new BumpAndCommitChangelogVersionViaKeepAChangelog(
$changelogExists,
$checkoutBranch,
$commit,
$push,
$logger
);
/** @psalm-suppress DeprecatedClass */
$application = new Application(Versions::rootPackageName(), Versions::getVersion('laminas/automatic-releases'));
$application->addCommands([
new ReleaseCommand(
$variables,
$loadEvent,
$fetch,
$getCandidateBranches,
$getMilestone,
$commitChangelog,
$createReleaseText,
new CreateTagViaConsole(),
$push,
$createRelease
),
new CreateMergeUpPullRequest(
$variables,
$loadEvent,
$fetch,
$getCandidateBranches,
$getMilestone,
$createCommitText,
$push,
new CreatePullRequestThroughApiCall(
$makeRequests,
$httpClient,
$githubToken
)
),
new SwitchDefaultBranchToNextMinor(
$variables,
$loadEvent,
$fetch,
$getCandidateBranches,
$push,
new SetDefaultBranchThroughApiCall(
$makeRequests,
$httpClient,
$githubToken
),
$bumpChangelogVersion
),
new BumpChangelogForReleaseBranch(
$variables,
$loadEvent,
$fetch,
$getCandidateBranches,
$bumpChangelogVersion
),
new CreateMilestones(
$loadEvent,
new CreateMilestoneThroughApiCall(
$makeRequests,
$httpClient,
$githubToken,
$logger
)
),
]);
$application->run();
})();

Note how bin/console is really just doing some DI setup :)

@glensc
Copy link
Contributor Author

glensc commented Jan 18, 2022

I was hoping of configuration via:

  1. env variables
  2. "with:" action paramters
  3. command-line arguments

not forking code and ecosystem around it 🗡️

but, have you though of having a container to define dependencies, like:

so, I could provide my override container if just want to wiggle few bits.

@Ocramius
Copy link
Member

Potentially feasible, but this application was never designed for customization, rather quick iteration and ease of use (which is quite a challenge already, given the GPG requirements).

IMO forking + customizing is the way to go here, as it is not a library, but an application.

If I can get rid of a config setting, and instead make it a default, I'll gladly do that instead.

@Ocramius
Copy link
Member

Very similar/related: Roave/BackwardCompatibilityCheck#377

In fact, bin/console is the only thing to replace.

@glensc
Copy link
Contributor Author

glensc commented Jan 18, 2022

but that's replacing whole bin/console content... instead of just overriding single thing: $container->set(SOMEDEPENDENCY, SOMETHINGELSE)

@Ocramius
Copy link
Member

Ocramius commented Jan 18, 2022

Yes, and that's no big deal, especially if you just need one of the many commands.

It is intentional/by design.

EDIT: in fact, give it a shot - if all you need is a single command to override, writing your own little script that uses symbols from this library should be enough, and quicker to write/easier to maintain than actually inventing a configuration DSL.

@Ocramius Ocramius self-assigned this Jan 18, 2022
@WyriHaximus
Copy link

@Ocramius Will this do? jwage/changelog-generator#71

@Ocramius
Copy link
Member

Most likely, ya - not sure about the difference in output between grouped/non-grouped: the tests are quite hard to read

@WyriHaximus
Copy link

The only thing non-grouped will do is set that label to anything without a group. Will improve the wording, also not sure if non-grouped is the right term here 🤐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants