Skip to content

Commit

Permalink
lol
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Apr 20, 2024
1 parent 5ceb75a commit d08b247
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/webserver/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,25 @@ const actionCompleted = async (client: Client, req: Request) => {
githubMap.get(workflow_run.id)!
);

let versionOrVersionAndLogs = `Version: **${version}**`

if (!workflow_run.conclusion) {
const runId = workflow_run.id
const jobId: string = await fetch(`https://api.github.com/repos/Layers-of-Railways/Railway/actions/runs/${runId}/jobs`)
.then(response => response.json())
.then(data => {
if (data.jobs && data.jobs.length > 0) {
return data.jobs[0].id;
} else {
return "error"
}
})
const logsUrl = `https://github.com/Layers-of-Railways/Railway/actions/runs/${workflow_run.id}/job/${jobId}`

versionOrVersionAndLogs += `[Run logs](${logsUrl})`
}


const embed = new EmbedBuilder()
.setAuthor({
name: `${repository.name}/${workflow_run.head_branch}`,
Expand All @@ -137,7 +156,7 @@ const actionCompleted = async (client: Client, req: Request) => {
.setDescription(
`## Build <t:${unix_started_at}:R>
Status: **${status} #${workflow_run.run_number}** in ${timeTaken}
Version: **${version}**
${versionOrVersionAndLogs}
${commitString}
`
)
Expand Down

0 comments on commit d08b247

Please sign in to comment.