Skip to content

Commit

Permalink
Treat workflow_dispatch event (manual launch) the same as "build from…
Browse files Browse the repository at this point in the history
… the default branch)
  • Loading branch information
vlsi committed Aug 15, 2020
1 parent 8d3e9cc commit 48e88ce
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ sealed class ActionsTrigger(val name: String, open val event: Event) {
class PullRequest(override val event: PullRequestEvent) : ActionsTrigger("pull_request", event)
class BranchPush(override val event: BranchPushEvent) : ActionsTrigger("push", event)
class Schedule(name: String, event: Event) : ActionsTrigger(name, event)
class WorkflowDispatch(name: String, event: Event) : ActionsTrigger(name, event)
class Other(name: String, event: Event) : ActionsTrigger(name, event)
}

Expand All @@ -35,7 +36,8 @@ val ActionsTrigger.cacheKey: String
GradleCacheAction.DEFAULT_BRANCH_VAR
else -> ref
}
is ActionsTrigger.Schedule -> GradleCacheAction.DEFAULT_BRANCH_VAR
is ActionsTrigger.Schedule, is ActionsTrigger.WorkflowDispatch ->
GradleCacheAction.DEFAULT_BRANCH_VAR
is ActionsTrigger.Other -> "$name-${ActionsEnvironment.GITHUB_WORKFLOW}-${ActionsEnvironment.GITHUB_SHA}"
}

Expand All @@ -47,6 +49,7 @@ suspend fun currentTrigger(): ActionsTrigger {
"pull_request" -> ActionsTrigger.PullRequest(event as PullRequestEvent)
"push" -> ActionsTrigger.BranchPush(event as BranchPushEvent)
"schedule" -> ActionsTrigger.Schedule(eventName, event)
"workflow_dispatch" -> ActionsTrigger.WorkflowDispatch(eventName, event)
else -> ActionsTrigger.Other(eventName, event)
}
}

0 comments on commit 48e88ce

Please sign in to comment.