Chenged color attribute and added emojis to show run status on mobile.

This commit is contained in:
Tomáš Musil 2024-07-04 15:45:49 +02:00
parent d454e89334
commit d9e8862eb8
2 changed files with 12 additions and 12 deletions

12
dist/index.js vendored
View File

@ -231344,11 +231344,11 @@ try {
const statusOpts = { const statusOpts = {
success: { success: {
status: 'Success', status: '🟢 Success',
color: 0x28A745, color: 0x28A745,
}, },
failure: { failure: {
status: 'Failure', status: '🔴 Failure',
color: 0xCB2431, color: 0xCB2431,
}, },
cancelled: { cancelled: {
@ -231360,19 +231360,19 @@ 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}</h4> <h4 data-mx-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>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>
${md.render(message)}`; ${md.render(message)}`;
// Send message // Send message
const content = { const content = {
msgtype: messagetype, msgtype: messagetype,
format: 'org.matrix.custom.html', format: 'org.matrix.custom.html',
body: message, body: `${statusOpts[status].status} ${workflow} @${actor}`,
formatted_body: formattedMessage, formatted_body: formattedMessage,
}; };

View File

@ -42,11 +42,11 @@ try {
const statusOpts = { const statusOpts = {
success: { success: {
status: 'Success', status: '🟢 Success',
color: 0x28A745, color: 0x28A745,
}, },
failure: { failure: {
status: 'Failure', status: '🔴 Failure',
color: 0xCB2431, color: 0xCB2431,
}, },
cancelled: { cancelled: {
@ -58,19 +58,19 @@ 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}</h4> <h4 data-mx-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>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>
${md.render(message)}`; ${md.render(message)}`;
// Send message // Send message
const content = { const content = {
msgtype: messagetype, msgtype: messagetype,
format: 'org.matrix.custom.html', format: 'org.matrix.custom.html',
body: message, body: `${statusOpts[status].status} ${workflow} @${actor}`,
formatted_body: formattedMessage, formatted_body: formattedMessage,
}; };