-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgitlab.json
10 lines (10 loc) · 2.91 KB
/
gitlab.json
1
2
3
4
5
6
7
8
9
10
{
"token": "your-appservice-webhooks-token",
"url": "https://matrix.example.org/appservice-webhooks/api/v1/matrix/hook/",
"displayName": "GitLab",
"avatar": "https://i.gyazo.com/thumb/1000/566debcae9702858a0ae487543e58123-png.png",
"template": "{% if object_kind in ['push', 'build'] %}{% if event_name is defined and event_name == 'push' %}[<strong><a href=\"{{ repository.homepage }}\">{{ project.path_with_namespace }}</a></strong>]<br>{{ user_name }} pushed <code>{{ checkout_sha[:7] }}</code> to {% if 'refs/heads/' in ref %}branch <a href=\"{{ repository.homepage }}/-/tree/{{ ref|replace('refs/heads/', '') }}\"><strong>{{ ref|replace('refs/heads/', '') }}</strong></a>{% else %}{{ ref }}{% endif %}<br>{% if commits %}commits:<br><ul>{% for c in (commits|sort(reverse=true, attribute='timestamp'))[:18] %}<li><a href=\"{{ repository.homepage }}/-/commit/{{ c.id }}\"><code>{{ c.id[:7] }}</code></a> {{ c.author.name }}: {{ c.title }}</li>{% endfor %}{% if (commits|length) is ge 20 %}<li><a href=\"{{ repository.homepage }}/-/commits{% if 'refs/heads/' in ref %}/{{ ref|replace('refs/heads/', '') }}{% endif %}\">view more commits on GitLab</a></li>{% endif %}</ul>{% endif %}{% elif object_kind == 'build' and build_status in ['failed', 'success'] %}[<strong><a href=\"{{ repository.homepage }}\">{{ project_name }}</a></strong>]<br>CI build <font color=\"{% if build_status == 'success' %}#00ff00{% elif build_status == 'failed' %}red{% else %}white{% endif %}\">{{ build_status }}</font> <strong><a href=\"{{ repository.homepage }}/-/jobs/{{ build_id }}\">#{{ build_id }}</a></strong><br>ref <em>{{ ref }}</em> (HEAD commit <code>{{ commit.sha[:7] }}</code> \"<em>{{ commit.message|trim }}</em>\")<br>using configuration <em>{{ build_name }}</em>{% if runner %} on runner <em>{{ runner.description }}</em>{% endif %}<br>{% endif %}{% elif object_kind == 'pipeline' %}[<strong><a href=\"{{ project.web_url }}\">{{ project.path_with_namespace }}</a></strong>]<br>CI pipeline <font color=\"{% if object_attributes.status == 'success' %}#00ff00{% elif object_attributes.status == 'failed' %}red{% else %}white{% endif %}\">{{ object_attributes.detailed_status }}</font> <strong><a href=\"{{ project.web_url }}/-/pipelines/{{ object_attributes.id }}\">#{{ object_attributes.id }}</a></strong> ref <em>{{ object_attributes.ref }}</em> (commit <a href=\"{{ project.web_url }}/-/commit/{{ commit.id }}\"><code>{{ commit.id[:7] }}</code></a> \"<em>{{ commit.message|trim }}</em>\")<br>{% if builds %}<ol>{% for build in builds %}<li><a href=\"{{ project.web_url }}/-/jobs/{{ build.id }}\">#{{ build.id }}</a> <em>{{ build.name }}</em>{% if build.runner is sameas true %} on runner <em>{{ build.runner.description }}</em>{% endif %}</li>{% endfor %}</ol>{% endif %}{% endif %}",
"defaultFormat": "html",
"defaultEmoji": false,
"defaultMsgtype": "{% if build_status is defined and build_status == 'failed' %}plain{% else %}notice{% endif %}"
}