diff --git a/docs/registrar/jira/config.md b/docs/registrar/jira/config.md index 533d10e..0a9ef17 100644 --- a/docs/registrar/jira/config.md +++ b/docs/registrar/jira/config.md @@ -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 ], diff --git a/src/Service/Registrar/JIRA/IssueConfig.php b/src/Service/Registrar/JIRA/IssueConfig.php index 7c8cce1..d9f2d19 100644 --- a/src/Service/Registrar/JIRA/IssueConfig.php +++ b/src/Service/Registrar/JIRA/IssueConfig.php @@ -17,6 +17,7 @@ class IssueConfig * @var string[] */ private array $labels; + private ?string $priority; private string $projectKey; private string $tagPrefix; @@ -30,6 +31,7 @@ public function __construct(array $config) 'assignee' => null, 'components' => [], 'labels' => [], + 'priority' => null, 'tagPrefix' => '', ]; $issue = $config['issue'] + $issueDefaults; @@ -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']; } @@ -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; diff --git a/src/Service/Registrar/JIRA/IssueFieldFactory.php b/src/Service/Registrar/JIRA/IssueFieldFactory.php index cd1202b..0f5ef09 100644 --- a/src/Service/Registrar/JIRA/IssueFieldFactory.php +++ b/src/Service/Registrar/JIRA/IssueFieldFactory.php @@ -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()));