Skip to content

Commit

Permalink
Merge 0af8db3 into a73fee8
Browse files Browse the repository at this point in the history
  • Loading branch information
eiriksm committed Jan 25, 2023
2 parents a73fee8 + 0af8db3 commit fad6972
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ Currently it receives the following variables:
`package`: The name of the package being updated.

`changed_files`: An array of the files changed in the update, if available.

`release_notes`: An array of links to release notes, if available.
14 changes: 13 additions & 1 deletion preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@
$update->setNewVersion('1.0.1');
$update->setUpdatedList($update_items);
$update->setChangedFiles(['README.md', 'composer.json']);
$update->setPackageReleaseNotes([
'- [Release notes for tag 8.x-1.27](https://www.drupal.org/project/admin_toolbar/releases/8.x-1.27)',
'- [Release notes for tag 8.x-1.26](https://www.drupal.org/project/admin_toolbar/releases/8.x-1.26)',
'- [Release notes for tag 8.x-1.25](https://www.drupal.org/project/admin_toolbar/releases/8.x-1.25)',
'- [Release notes for tag 8.x-1.24](https://www.drupal.org/project/admin_toolbar/releases/8.x-1.24)',
'- [Release notes for tag 8.x-1.23](https://www.drupal.org/project/admin_toolbar/releases/8.x-1.23)',
'- [Release notes for tag 8.x-1.22](https://www.drupal.org/project/admin_toolbar/releases/8.x-1.22)',
'- [Release notes for tag 8.x-1.21](https://www.drupal.org/project/admin_toolbar/releases/8.x-1.21)',
'- [Release notes for tag 8.x-1.20](https://www.drupal.org/project/admin_toolbar/releases/8.x-1.20)',
'- [Release notes for tag 8.x-1.19](https://www.drupal.org/project/admin_toolbar/releases/8.x-1.19)',
'- [Release notes for tag 8.x-1.18](https://www.drupal.org/project/admin_toolbar/releases/8.x-1.18)',
]);
$update->setChangelog('- [e8c563c47](https://github.com/vendor/updated_package/commit/e8c563c47) `Prepare release`
- [87e59a5e7](https://github.com/vendor/updated_package/commit/87e59a5e7) `Update`
- [5b351a5de](https://github.com/vendor/updated_package/commit/5b351a5de) `Change`
Expand Down Expand Up @@ -57,7 +69,7 @@
</body>
</html>
';

print_r($converter->convert($message->getPullRequestBody($update))));
file_put_contents("$directory/body.html", sprintf($template, $converter->convert($message->getPullRequestBody($update))));
file_put_contents("$directory/index.html", sprintf($template, ' <ul>
<li>
Expand Down
1 change: 1 addition & 0 deletions src/ViolinistMessages.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public function getPullRequestBody(ViolinistUpdate $msg)
'title' => $this->getPullRequestTitle($msg),
'changelog' => $msg->getChangelog(),
'changed_files' => $msg->getChangedFiles(),
'release_notes' => $msg->getReleaseNotes(),
'custom_message' => $msg->getCustomMessage(),
'package' => $msg->getName(),
]);
Expand Down
12 changes: 12 additions & 0 deletions src/ViolinistUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class ViolinistUpdate

private $changedFiles = [];

protected $packageReleaseNotes = [];

/**
* @return array
*/
Expand All @@ -50,6 +52,11 @@ public function getChangedFiles(): array
return $this->changedFiles;
}

public function getReleaseNotes(): array
{
return $this->packageReleaseNotes;
}

/**
* @param array $changedFiles
*/
Expand Down Expand Up @@ -185,4 +192,9 @@ public static function fromLegacyFormat(array $item)
$update->setNewVersion($item[2]);
return $update;
}

public function setPackageReleaseNotes($release_notes_for_package)
{
$this->packageReleaseNotes = $release_notes_for_package;
}
}
14 changes: 13 additions & 1 deletion templates/pull-request-body.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,20 @@ Some times an update also needs new or updated dependencies to be installed. Eve
{{ updated_list }}

{% endif %}
{% if changed_files %}
{% if release_notes %}
### Release notes

Here are the release notes for all versions released between your current running version, and the version this PR updates the package to.

<details>
<summary>List of release notes</summary>
{% for link in release_notes %}
{{ link }}
{% endfor %}
</details>

{% endif%}
{% if changed_files %}
### Changed files

Here is a list of changed files between the version you use, and the version this pull request updates to:
Expand Down

0 comments on commit fad6972

Please sign in to comment.