certegroep/symfony-jira-issue-notifier

Symfony Atlassian Jira Notifier 桥接器

1.0.0 2024-07-25 08:49 UTC

This package is auto-updated.

Last update: 2024-09-26 05:46:56 UTC


README

为 Symfony Notifier 提供 Atlassian Jira 集成。用于在 Jira 问题中发表评论。

DSN 示例

ATLASSIAN_JIRA_DSN=jira-issue://{user}@{access_token}:{your_atlassian_slug}.atlassian.net

其中

  • {user} 是用于发表评论的账户电子邮件或用户名
  • {access_token} 是账户的密码或访问令牌
  • {your_atlassian_slug} 是您的 Atlassian URL 名称(可能以 .atlassian.net 结尾)

向消息添加文本

使用此 Jira 问题评论,您可以使用 JiraIssueComment

use CerteGroep\Component\Notifier\JiraIssue\Message\IssueCommentMessage;
use CerteGroep\Component\Notifier\JiraIssue\Message\JiraIssueCommentOptions;

$options = (new JiraIssueCommentOptions())->generic('This is a test...');
$message = (new IssueCommentMessage('KEY-1234', $options));

$texter->send($message);

支持多种评论类型

表情文本

添加带有表情图标的前缀评论。
使用表情键/名称来表示正确的图标。请参阅 Jira 评论框以查看您可以使用的所有表情。

$options = (new JiraIssueCommentOptions())->emojiText('tada', 'Fixed it!');

面板

带有文本消息前带有勾选标记的绿色框

$options = (new JiraIssueCommentOptions())->success('Fixed it!');

带有文本消息前带有信息图标的框

$options = (new JiraIssueCommentOptions())->info('Did you know...');

带有文本消息前带有感叹号三角形的橙色/黄色框

$options = (new JiraIssueCommentOptions())->warning('Uh oh! Check this out...');

带有文本消息前带有叉号的红色框

$options = (new JiraIssueCommentOptions())->error('Something went wrong');

检查列表评论

默认情况下,带有 true 的文本项将带有勾选标记图标,而带有 false 标志的项目将带有叉号标记图标。

$options = (new JiraIssueCommentOptions())->checklist([
    'List item 1' => true,
    'List item 2' => true,
    'List item 3' => false,
    'List item 4' => true,
]);

此外,您还可以向检查列表添加一些简介文本;

$options = (new JiraIssueCommentOptions())->checklist([
    'List item 1' => true,
    'List item 2' => true,
    'List item 3' => false,
    'List item 4' => true,
], 'This is why we did that...');

要更改默认的 true/false 图标;

$options = (new JiraIssueCommentOptions())->checklist([
    'List item 1' => true,
    'List item 2' => true,
    'List item 3' => false,
    'List item 4' => true,
], null, 'partying_face', 'worried');

自定义格式

消息的格式由 Atlassian 文档格式 构建。

该格式由 Damien Harper 的 ADF 工具 实现。有关详细信息,请参阅文档。

$options = (new JiraIssueCommentOptions())->custom(
    JiraIssueCommentOptions::doc()
        ->paragraph()
            ->text('This is a text line')
        ->end()
);