Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add workflow URL to event payload #12

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/tb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type WorkflowEvent = {
repository: string
attempt: number
outcome: string
workflow_url: string
}

export async function createWorkflowEvent(
Expand All @@ -19,6 +20,7 @@ export async function createWorkflowEvent(
workflow_id = '',
outcome: string
): Promise<WorkflowEvent> {
const attempt = parseInt(process.env.GITHUB_RUN_ATTEMPT as string, 10)
const event: WorkflowEvent = {
run_id: github.context.runId.toString(),
start,
Expand All @@ -27,8 +29,9 @@ export async function createWorkflowEvent(
branch: github.context.ref.split('/').pop() || '',
workflow: workflow_id === '' ? github.context.workflow : workflow_id,
repository: `${github.context.repo.owner}/${github.context.repo.repo}`,
attempt: parseInt(process.env.GITHUB_RUN_ATTEMPT as string, 10),
outcome
attempt,
outcome,
workflow_url: `${github.context.serverUrl}/${github.context.repo.owner}/${github.context.repo.repo}/actions/runs/${github.context.runId}/attempts/${attempt}`
}
return event
}
Expand Down
Loading