Skip to content

Commit

Permalink
Merge pull request #166 from mdedetrich/make-workflow-dir-configurable
Browse files Browse the repository at this point in the history
Make workflow dir configurable
  • Loading branch information
mdedetrich authored Sep 28, 2023
2 parents 04f573a + 6bb931a commit 9ad5eea
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ ThisBuild / githubWorkflowPublish := Seq(

### General

- `githubWorkflowDir` : `File` - Where to place the workflow directory which contains the generated ci.yml and clean.yml files. (default: `baseDirectory.value / ".github"`)
- `githubIsWorkflowBuild` : `Boolean` – Indicates whether or not the build is currently running within a GitHub Actions Workflow
- `githubWorkflowName` : `String` – The name of the currently-running workflow. Will be undefined if not running in GitHub Actions.
- `githubWorkflowDefinition` : `Map[String, Any]` – The raw (parsed) contents of the workflow YAML definition. Will be undefined if not running in GitHub Actions, or if (for some reason) the workflow could not be identified. Workflows are located by taking the `githubWorkflowName` and finding the YAML definition which has the corresponding `name:` key/value pair.
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/sbtghactions/GenerativeKeys.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ trait GenerativeKeys {
lazy val githubWorkflowGenerate = taskKey[Unit]("Generates (and overwrites if extant) a ci.yml and clean.yml actions description according to configuration")
lazy val githubWorkflowCheck = taskKey[Unit]("Checks to see if the ci.yml and clean.yml files are equivalent to what would be generated and errors if otherwise")

lazy val githubWorkflowDir = settingKey[File]("Where to place the workflow directory which contains the generated ci.yml and clean.yml files. (default: baseDirectory.value / \".github\")")
lazy val githubWorkflowGeneratedCI = settingKey[Seq[WorkflowJob]]("The sequence of jobs which will make up the generated ci workflow (ci.yml)")
lazy val githubWorkflowGeneratedUploadSteps = settingKey[Seq[WorkflowStep]]("The sequence of steps used to upload intermediate build artifacts for an adjacent job")
lazy val githubWorkflowGeneratedDownloadSteps = settingKey[Seq[WorkflowStep]]("The sequence of steps used to download intermediate build artifacts published by an adjacent job")
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/sbtghactions/GenerativePlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)}
}

private val workflowsDirTask = Def task {
val githubDir = baseDirectory.value / ".github"
val githubDir = githubWorkflowDir.value
val workflowsDir = githubDir / "workflows"

if (!githubDir.exists()) {
Expand Down Expand Up @@ -867,7 +867,8 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)}

if (includeClean)
compare(cleanYml, expectedCleanContents)
})
},
githubWorkflowDir := baseDirectory.value / ".github")

private[sbtghactions] def diff(expected: String, actual: String): String = {
val expectedLines = expected.split("\n", -1)
Expand Down

0 comments on commit 9ad5eea

Please sign in to comment.