Skip to content

Fix release markdown rendering of double newlines #176

Closed

Description

@glensc

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

Activity

  1. glensc commented on Jan 18, 2022

    @glensc
    ContributorAuthor

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

  2. Ocramius commented on Jan 18, 2022

    @Ocramius
    Member

    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 :)

  3. glensc commented on Jan 18, 2022

    @glensc
    ContributorAuthor

    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.

  4. Ocramius commented on Jan 18, 2022

    @Ocramius
    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.

  5. Ocramius commented on Jan 18, 2022

    @Ocramius
    Member

    Very similar/related: Roave/BackwardCompatibilityCheck#377

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

  6. glensc commented on Jan 18, 2022

    @glensc
    ContributorAuthor

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

  7. Ocramius commented on Jan 18, 2022

    @Ocramius
    Member

    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.

  8. self-assigned this
    on Jan 18, 2022
  9. WyriHaximus commented on Jan 23, 2022

    @WyriHaximus
  10. Ocramius commented on Jan 23, 2022

    @Ocramius
    Member

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

  11. WyriHaximus commented on Jan 23, 2022

    @WyriHaximus

    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

Metadata

Metadata

Assignees

Labels

BugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions