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

OPENEUROPA-0000: Allow to specify a release branch for the changelog generation command #107

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
9 changes: 7 additions & 2 deletions src/Commands/ChangelogCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ public function getConfigurationFile()
*
* @command changelog:generate
*
* @option token GitHub personal access token, to generate one visit https://github.com/settings/tokens/new
* @option tag Upcoming tag you wish to generate a new changelog entry for.
* @option token GitHub personal access token, to generate one visit https://github.com/settings/tokens/new
* @option tag Upcoming tag you wish to generate a new changelog entry for.
* @option release-branch Limit list of changes that went into a specific release branch.
*
* @aliases changelog:g,cg
*
Expand All @@ -43,13 +44,17 @@ public function getConfigurationFile()
public function generateChangelog(array $options = [
'token' => InputOption::VALUE_REQUIRED,
'tag' => InputOption::VALUE_OPTIONAL,
'release-branch' => InputOption::VALUE_OPTIONAL,
])
{
$projectName = $this->getComposer()->getName();
$exec = "{$projectName} -t {$options['token']}";
if (!empty($options['tag'])) {
$exec .= " --future-release={$options['tag']}";
}
if (!empty($options['release-branch'])) {
$exec .= " --release-branch={$options['release-branch']}";
}

$task = $this->taskDockerRun('muccg/github-changelog-generator')
->option('rm')
Expand Down
15 changes: 13 additions & 2 deletions tests/fixtures/simulation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
contains:
- "exec('foo/bar -t abc --future-release=1.2.3')"

- command: 'changelog:generate --token 123 --tag 1.2.3'
- command: 'changelog:generate --release-branch foo'
configuration:
github:
token: "abc"
Expand All @@ -133,7 +133,18 @@
"name": "foo/bar"
}
contains:
- "exec('foo/bar -t 123 --future-release=1.2.3')"
- "exec('foo/bar -t abc --release-branch=foo')"

- command: 'changelog:generate --token 123 --tag 1.2.3 --release-branch foo'
configuration:
github:
token: "abc"
composer: >
{
"name": "foo/bar"
}
contains:
- "exec('foo/bar -t 123 --future-release=1.2.3 --release-branch=foo')"

- command: 'drupal:site-post-install'
configuration:
Expand Down