Added ref and fixed workflow name.
This commit is contained in:
parent
e07a81e055
commit
4c101e89ae
7
index.js
7
index.js
@ -23,7 +23,7 @@ try {
|
|||||||
|
|
||||||
const { owner, repo } = ctx.repo;
|
const { owner, repo } = ctx.repo;
|
||||||
const {
|
const {
|
||||||
workflow, actor, payload, serverUrl, runNumber,
|
ref, workflow, actor, payload, serverUrl, runNumber,
|
||||||
} = ctx;
|
} = ctx;
|
||||||
|
|
||||||
const repoURL = `${serverUrl}/${owner}/${repo}`;
|
const repoURL = `${serverUrl}/${owner}/${repo}`;
|
||||||
@ -58,9 +58,10 @@ try {
|
|||||||
const userMention = status === 'success' ? actor : `<a href="https://matrix.to/#/@${actor}:${homeserver}">${actor}</a>`;
|
const userMention = status === 'success' ? actor : `<a href="https://matrix.to/#/@${actor}:${homeserver}">${actor}</a>`;
|
||||||
|
|
||||||
const formattedMessage = `
|
const formattedMessage = `
|
||||||
<h4 style="color: ${statusOpts[status].color}">${statusOpts[status].status} ${workflow.name}</h4>
|
<h4 style="color: ${statusOpts[status].color}">${statusOpts[status].status} ${workflow}</h4>
|
||||||
<p><strong>Repository</strong> <a href="${repoURL}">${owner}/${repo}</a><br>
|
<p><strong>Repository</strong> <a href="${repoURL}">${owner}/${repo}</a><br>
|
||||||
<strong>Commit</strong> <a href="${payload.head_commit.url}">${payload.head_commit.id.substring(0, 7)}</a> ${payload.head_commit.message}<br>
|
<strong>Commit</strong> <a href="${payload.head_commit.url}">${payload.head_commit.id.substring(0, 7)}</a> ${payload.head_commit.message}<br>
|
||||||
|
<strong>Ref</strong> ref<br>
|
||||||
<strong>Triggered by</strong> ${userMention}<br>
|
<strong>Triggered by</strong> ${userMention}<br>
|
||||||
<strong>Run</strong> <a href="${runURL}">#${runNumber}</a><br>
|
<strong>Run</strong> <a href="${runURL}">#${runNumber}</a><br>
|
||||||
${md.render(message)}`;
|
${md.render(message)}`;
|
||||||
@ -73,7 +74,7 @@ ${md.render(message)}`;
|
|||||||
formatted_body: formattedMessage,
|
formatted_body: formattedMessage,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (status === 'success') content['m.mentions'] = { user_ids: [`@${actor}:${homeserver}`] };
|
if (status !== 'success') content['m.mentions'] = { user_ids: [`@${actor}:${homeserver}`] };
|
||||||
|
|
||||||
client.sendEvent(channel, 'm.room.message', content, '').then(() => {
|
client.sendEvent(channel, 'm.room.message', content, '').then(() => {
|
||||||
// message sent successfully
|
// message sent successfully
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user