Skip to content

Commit

Permalink
Config priority of JIRA-issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeliot-Tm committed Jun 13, 2024
1 parent d9002df commit 5da8610
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/registrar/jira/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ $jiraConfig = [
// when "assignee-suffix" was not used with tag.
'components' => ['a-component'], // list of components which will be set to issue
'labels' => ['a-label'], // list of labels which will be set to issue
'priority' => 'string', // priority of issue
'tagPrefix' => 'tag-', // prefix which will be added to tag when "addTagToLabels=true"
'type' => 'Bug', // type of issue
],
Expand Down
8 changes: 8 additions & 0 deletions src/Service/Registrar/JIRA/IssueConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class IssueConfig
* @var string[]
*/
private array $labels;
private ?string $priority;
private string $projectKey;
private string $tagPrefix;

Expand All @@ -30,6 +31,7 @@ public function __construct(array $config)
'assignee' => null,
'components' => [],
'labels' => [],
'priority' => null,
'tagPrefix' => '',
];
$issue = $config['issue'] + $issueDefaults;
Expand All @@ -38,6 +40,7 @@ public function __construct(array $config)
$this->components = (array) $issue['components'];
$this->issueType = $issue['type'];
$this->labels = (array) $issue['labels'];
$this->priority = $config['priority'];
$this->projectKey = $config['projectKey'];
$this->tagPrefix = $issue['tagPrefix'];
}
Expand Down Expand Up @@ -73,6 +76,11 @@ public function getLabels(): array
return $this->labels;
}

public function getPriority(): ?string
{
return $this->priority;
}

public function getProjectKey(): string
{
return $this->projectKey;
Expand Down
5 changes: 5 additions & 0 deletions src/Service/Registrar/JIRA/IssueFieldFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ public function create(Todo $todo): IssueField
$issueField->setAssigneeNameAsString($assignee);
}

$priority = $this->issueConfig->getPriority();
if ($priority) {
$issueField->setPriorityNameAsString($priority);
}

$labels = $this->issueConfig->getLabels();
if ($this->issueConfig->isAddTagToLabels()) {
$labels[] = strtolower(sprintf('%s%s', $this->issueConfig->getTagPrefix(), $todo->getTag()));
Expand Down

0 comments on commit 5da8610

Please sign in to comment.