Skip to content

Commit

Permalink
OPENEUROPA-0000: Allow to specify a release branch for the changelog …
Browse files Browse the repository at this point in the history
…generation command.
  • Loading branch information
brummbar committed Oct 16, 2019
1 parent 0ee1c8f commit 4c9bdb7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
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 pull requests to a specific 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

0 comments on commit 4c9bdb7

Please sign in to comment.