Skip to content

ActionContext

Sealed interface for all GitHub event contexts.

Source: core/src/main/kotlin/ir/amirroid/workflowkt/context/ActionContext.kt

Definition

sealed interface ActionContext {
    val repository: Repository
}

All context types implement this interface and provide access to the repository where the event occurred.


IssueContext

Source: core/src/main/kotlin/ir/amirroid/workflowkt/context/IssueContext.kt Event: issues

data class IssueContext(
    override val repository: Repository,
    val issue: Issue,
    val action: String,
    val sender: User,
    val changes: Changes = emptyMap()
) : ActionContext
Property Type Description
repository Repository The repository where the issue was created/modified
issue Issue Full issue data including title, body, labels, assignees
action String The action that triggered the event (e.g., "opened", "edited", "closed")
sender User The user who triggered the event
changes Changes Map of field changes (only present on edited events)

PullRequestContext

Source: core/src/main/kotlin/ir/amirroid/workflowkt/context/PullRequestContext.kt Event: pull_request

data class PullRequestContext(
    override val repository: Repository,
    val pullRequest: PullRequest,
    val sender: User,
    val action: String,
    val after: String?,
    val before: String?,
    val number: Int
) : ActionContext
Property Type Description
repository Repository The repository where the PR was created
pullRequest PullRequest Full PR data including title, body, head/base branches, labels
sender User The user who triggered the event
action String Action that triggered the event (e.g., "opened", "synchronize", "reopened")
after String? New commit SHA (present on synchronize events)
before String? Previous commit SHA (present on synchronize events)
number Int The pull request number

PushContext

Source: core/src/main/kotlin/ir/amirroid/workflowkt/context/PushContext.kt Event: push

data class PushContext(
    val ref: String,
    val baseRef: String?,
    val before: String,
    val after: String,
    val compare: String,
    val created: Boolean,
    val deleted: Boolean,
    val forced: Boolean,
    val headCommit: HeadCommit?,
    val commits: List<Commit>,
    val pusher: Actor,
    val sender: User,
    override val repository: Repository
) : ActionContext
Property Type Description
ref String Full ref path (e.g., "refs/heads/main")
baseRef String? Base ref for compare URL
before String Previous commit SHA
after String New commit SHA
compare String URL to compare the changes
created Boolean Whether the branch was just created
deleted Boolean Whether the branch was deleted
forced Boolean Whether the push was a force push
headCommit HeadCommit? The head commit of the push
commits List<Commit> All commits included in the push
pusher Actor Who pushed the commits
sender User The user who triggered the event
repository Repository The repository where the push occurred

ReleaseContext

Source: core/src/main/kotlin/ir/amirroid/workflowkt/context/ReleaseContext.kt Event: release

data class ReleaseContext(
    val action: String,
    val release: Release,
    val sender: User,
    override val repository: Repository
) : ActionContext
Property Type Description
action String Action that triggered the event (e.g., "published", "created", "edited")
release Release Full release data including tag, body, assets, author
sender User The user who triggered the event
repository Repository The repository where the release was created

ScheduleContext

Source: core/src/main/kotlin/ir/amirroid/workflowkt/context/ScheduleContext.kt Event: schedule

data class ScheduleContext(
    override val repository: Repository,
    val schedule: String,
    val workflow: String
) : ActionContext
Property Type Description
repository Repository The repository the workflow belongs to
schedule String The cron schedule expression (e.g., "0 0 * * *")
workflow String The workflow file path (e.g., ".github/workflows/ci.yml")

WorkflowDispatchContext

Source: core/src/main/kotlin/ir/amirroid/workflowkt/context/WorkflowDispatchContext.kt Event: workflow_dispatch

data class WorkflowDispatchContext(
    val inputs: WorkflowDispatchInputs?,
    val ref: String,
    val sender: User,
    override val repository: Repository
) : ActionContext

typealias WorkflowDispatchInputs = Map<String, String>
Property Type Description
inputs Map<String, String>? Custom inputs provided during manual trigger (nullable if none provided)
ref String The ref the workflow was triggered on
sender User The user who triggered the workflow
repository Repository The repository the workflow belongs to

CreateContext

Source: core/src/main/kotlin/ir/amirroid/workflowkt/context/CreateContext.kt Event: create

data class CreateContext(
    val description: String?,
    val masterBranch: String,
    val pusherType: PusherType,
    val ref: String,
    val refType: RefType,
    override val repository: Repository
) : ActionContext
Property Type Description
description String? Optional description of the ref
masterBranch String The default branch (e.g., "main")
pusherType PusherType Who created the ref (USER or DEPLOY_KEY)
ref String The name of the created ref
refType RefType Whether a BRANCH or TAG was created
repository Repository The repository where the ref was created