From 7340479d166748b2f89518160bd3a8bb034f2dc4 Mon Sep 17 00:00:00 2001 From: Darren Gibson Date: Fri, 9 Aug 2024 12:03:41 -0500 Subject: [PATCH 1/7] Add more `with*`, `update*`, and `add*` for Workflow step and jobs. --- .../org/typelevel/sbt/gha/WorkflowJob.scala | 6 ++ .../org/typelevel/sbt/gha/WorkflowStep.scala | 61 +++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala index 8fa63253..1977be0d 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala @@ -58,6 +58,9 @@ sealed abstract class WorkflowJob { def withEnvironment(environment: Option[JobEnvironment]): WorkflowJob def withConcurrency(concurrency: Option[Concurrency]): WorkflowJob def withTimeoutMinutes(timeoutMinutes: Option[Int]): WorkflowJob + + def updateEnv(name: String, value: String): WorkflowJob + def appendSteps(steps: List[WorkflowStep]): WorkflowJob } object WorkflowJob { @@ -149,6 +152,9 @@ object WorkflowJob { override def withEnvironment(environment: Option[JobEnvironment]): WorkflowJob = copy(environment = environment) override def withConcurrency(concurrency: Option[Concurrency]): WorkflowJob = copy(concurrency = concurrency) override def withTimeoutMinutes(timeoutMinutes: Option[Int]): WorkflowJob = copy(timeoutMinutes = timeoutMinutes) + + def updateEnv(name: String, value: String): WorkflowJob = withEnv(env.updated(name, value)) + def appendSteps(steps: List[WorkflowStep]): WorkflowJob = withSteps(this.steps ++ steps) // scalafmt: { maxColumn = 96 } override def productPrefix = "WorkflowJob" diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala index 748c8c0f..753e0996 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala @@ -28,6 +28,9 @@ sealed abstract class WorkflowStep extends Product with Serializable { def withCond(cond: Option[String]): WorkflowStep def withEnv(env: Map[String, String]): WorkflowStep def withTimeoutMinutes(minutes: Option[Int]): WorkflowStep + + def updateEnv(name: String, value: String): WorkflowStep + def addEnv(env: Map[String, String]): WorkflowStep } object WorkflowStep { @@ -118,6 +121,15 @@ object WorkflowStep { def commands: List[String] def params: Map[String, String] def workingDirectory: Option[String] + + def withCommands(commands: List[String]): Run + def withParams(params: Map[String, String]): Run + def withWorkingDirectory(workingDirectory: Option[String]): Run + + def updateEnv(name: String, value: String): Run + def addEnv(env: Map[String, String]): Run + def updateParams(name: String, value: String): Run + def addParams(params: Map[String, String]): Run } object Run { @@ -143,11 +155,22 @@ object WorkflowStep { workingDirectory: Option[String]) extends Run { override def productPrefix = "Run" + // scalafmt: { maxColumn = 200 } def withId(id: Option[String]) = copy(id = id) def withName(name: Option[String]) = copy(name = name) def withCond(cond: Option[String]) = copy(cond = cond) def withEnv(env: Map[String, String]) = copy(env = env) def withTimeoutMinutes(minutes: Option[Int]) = copy(timeoutMinutes = minutes) + + def withCommands(commands: List[String]) = copy(commands = commands) + def withParams(params: Map[String, String]) = copy(params = params) + def withWorkingDirectory(workingDirectory: Option[String]) = copy(workingDirectory = workingDirectory) + + def updateEnv(name: String, value: String) = copy(env = this.env.updated(name, value)) + def addEnv(env: Map[String, String]) = copy(env = this.env ++ env) + def updateParams(name: String, value: String) = copy(params = this.params.updated(name, value)) + def addParams(params: Map[String, String]) = copy(params = this.params ++ params) + // scalafmt: { maxColumn = 96 } } } @@ -155,6 +178,15 @@ object WorkflowStep { def commands: List[String] def params: Map[String, String] def preamble: Boolean + + def withCommands(commands: List[String]): Sbt + def withParams(params: Map[String, String]): Sbt + def withPreamble(preamble: Boolean): Sbt + + def updateEnv(name: String, value: String): Sbt + def addEnv(env: Map[String, String]): Sbt + def updateParams(name: String, value: String): Sbt + def addParams(params: Map[String, String]): Sbt } object Sbt { @@ -180,17 +212,36 @@ object WorkflowStep { preamble: Boolean) extends Sbt { override def productPrefix = "Sbt" + // scalafmt: { maxColumn = 200 } def withId(id: Option[String]) = copy(id = id) def withName(name: Option[String]) = copy(name = name) def withCond(cond: Option[String]) = copy(cond = cond) def withEnv(env: Map[String, String]) = copy(env = env) def withTimeoutMinutes(minutes: Option[Int]) = copy(timeoutMinutes = minutes) + + def withCommands(commands: List[String]) = copy(commands = commands) + def withParams(params: Map[String, String]) = copy(params = params) + def withPreamble(preamble: Boolean) = copy(preamble = preamble) + + def updateEnv(name: String, value: String) = copy(env = this.env.updated(name, value)) + def addEnv(env: Map[String, String]) = copy(env = this.env ++ env) + def updateParams(name: String, value: String) = copy(params = params.updated(name, value)) + def addParams(params: Map[String, String]) = copy(params = this.params ++ params) + // scalafmt: { maxColumn = 96 } } } sealed abstract class Use extends WorkflowStep { def ref: UseRef def params: Map[String, String] + + def withRef(ref: UseRef): Use + def withParams(params: Map[String, String]): Use + + def updateEnv(name: String, value: String): Use + def addEnv(env: Map[String, String]): Use + def updateParams(name: String, value: String): Use + def addParams(params: Map[String, String]): Use } object Use { @@ -215,11 +266,21 @@ object WorkflowStep { timeoutMinutes: Option[Int]) extends Use { override def productPrefix = "Use" + // scalafmt: { maxColumn = 200 } def withId(id: Option[String]) = copy(id = id) def withName(name: Option[String]) = copy(name = name) def withCond(cond: Option[String]) = copy(cond = cond) def withEnv(env: Map[String, String]) = copy(env = env) def withTimeoutMinutes(minutes: Option[Int]) = copy(timeoutMinutes = minutes) + + def withRef(ref: UseRef) = copy(ref = ref) + def withParams(params: Map[String, String]) = copy(params = params) + + def updateEnv(name: String, value: String) = copy(env = this.env.updated(name, value)) + def addEnv(env: Map[String, String]) = copy(env = this.env ++ env) + def updateParams(name: String, value: String) = copy(params = params.updated(name, value)) + def addParams(params: Map[String, String]) = copy(params = this.params ++ params) + // scalafmt: { maxColumn = 96 } } } } From b1b6c245b939192376c7fdd93d6c72f455aed488 Mon Sep 17 00:00:00 2001 From: Darren Gibson Date: Fri, 9 Aug 2024 12:23:21 -0500 Subject: [PATCH 2/7] Update mima filters --- github-actions/mima.sbt | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/github-actions/mima.sbt b/github-actions/mima.sbt index 745a7a23..f9e6e5f8 100644 --- a/github-actions/mima.sbt +++ b/github-actions/mima.sbt @@ -1,23 +1,17 @@ import com.typesafe.tools.mima.core._ mimaBinaryIssueFilters ++= Seq( - "org.typelevel.sbt.gha.WorkflowJob.withId", - "org.typelevel.sbt.gha.WorkflowJob.withName", - "org.typelevel.sbt.gha.WorkflowJob.withSteps", - "org.typelevel.sbt.gha.WorkflowJob.withSbtStepPreamble", - "org.typelevel.sbt.gha.WorkflowJob.withCond", - "org.typelevel.sbt.gha.WorkflowJob.withPermissions", - "org.typelevel.sbt.gha.WorkflowJob.withEnv", - "org.typelevel.sbt.gha.WorkflowJob.withOses", - "org.typelevel.sbt.gha.WorkflowJob.withScalas", - "org.typelevel.sbt.gha.WorkflowJob.withJavas", - "org.typelevel.sbt.gha.WorkflowJob.withNeeds", - "org.typelevel.sbt.gha.WorkflowJob.withMatrixFailFast", - "org.typelevel.sbt.gha.WorkflowJob.withMatrixAdds", - "org.typelevel.sbt.gha.WorkflowJob.withMatrixIncs", - "org.typelevel.sbt.gha.WorkflowJob.withMatrixExcs", - "org.typelevel.sbt.gha.WorkflowJob.withRunsOnExtraLabels", - "org.typelevel.sbt.gha.WorkflowJob.withContainer", - "org.typelevel.sbt.gha.WorkflowJob.withEnvironment", - "org.typelevel.sbt.gha.WorkflowJob.withConcurrency", - "org.typelevel.sbt.gha.WorkflowJob.withTimeoutMinutes" + "org.typelevel.sbt.gha.WorkflowJob.with*", + "org.typelevel.sbt.gha.WorkflowJob.append*", + "org.typelevel.sbt.gha.WorkflowJob.update*", + "org.typelevel.sbt.gha.WorkflowStep.update*", + "org.typelevel.sbt.gha.WorkflowStep.add*", + "org.typelevel.sbt.gha.WorkflowStep#Sbt.with*", + "org.typelevel.sbt.gha.WorkflowStep#Sbt.add*", + "org.typelevel.sbt.gha.WorkflowStep#Sbt.update*", + "org.typelevel.sbt.gha.WorkflowStep#Run.with*", + "org.typelevel.sbt.gha.WorkflowStep#Run.add*", + "org.typelevel.sbt.gha.WorkflowStep#Run.update*", + "org.typelevel.sbt.gha.WorkflowStep#Use.with*", + "org.typelevel.sbt.gha.WorkflowStep#Use.add*", + "org.typelevel.sbt.gha.WorkflowStep#Use.update*" ).map(ProblemFilters.exclude[ReversedMissingMethodProblem](_)) From ed6c621768c4a13e36b037f10179aa1f9037f743 Mon Sep 17 00:00:00 2001 From: Darren Gibson Date: Sat, 10 Aug 2024 09:53:13 -0500 Subject: [PATCH 3/7] Change name of update* and add* to updated* and append* --- .../org/typelevel/sbt/gha/WorkflowJob.scala | 4 +- .../org/typelevel/sbt/gha/WorkflowStep.scala | 52 +++++++++---------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala index 1977be0d..8901148b 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala @@ -59,7 +59,7 @@ sealed abstract class WorkflowJob { def withConcurrency(concurrency: Option[Concurrency]): WorkflowJob def withTimeoutMinutes(timeoutMinutes: Option[Int]): WorkflowJob - def updateEnv(name: String, value: String): WorkflowJob + def updatedEnv(name: String, value: String): WorkflowJob def appendSteps(steps: List[WorkflowStep]): WorkflowJob } @@ -153,7 +153,7 @@ object WorkflowJob { override def withConcurrency(concurrency: Option[Concurrency]): WorkflowJob = copy(concurrency = concurrency) override def withTimeoutMinutes(timeoutMinutes: Option[Int]): WorkflowJob = copy(timeoutMinutes = timeoutMinutes) - def updateEnv(name: String, value: String): WorkflowJob = withEnv(env.updated(name, value)) + def updatedEnv(name: String, value: String): WorkflowJob = withEnv(env.updated(name, value)) def appendSteps(steps: List[WorkflowStep]): WorkflowJob = withSteps(this.steps ++ steps) // scalafmt: { maxColumn = 96 } diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala index 753e0996..942dd919 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala @@ -29,8 +29,8 @@ sealed abstract class WorkflowStep extends Product with Serializable { def withEnv(env: Map[String, String]): WorkflowStep def withTimeoutMinutes(minutes: Option[Int]): WorkflowStep - def updateEnv(name: String, value: String): WorkflowStep - def addEnv(env: Map[String, String]): WorkflowStep + def updatedEnv(name: String, value: String): WorkflowStep + def appendEnv(env: Map[String, String]): WorkflowStep } object WorkflowStep { @@ -126,10 +126,10 @@ object WorkflowStep { def withParams(params: Map[String, String]): Run def withWorkingDirectory(workingDirectory: Option[String]): Run - def updateEnv(name: String, value: String): Run - def addEnv(env: Map[String, String]): Run - def updateParams(name: String, value: String): Run - def addParams(params: Map[String, String]): Run + def updatedEnv(name: String, value: String): Run + def appendEnv(env: Map[String, String]): Run + def updatedParams(name: String, value: String): Run + def appendParams(params: Map[String, String]): Run } object Run { @@ -166,10 +166,10 @@ object WorkflowStep { def withParams(params: Map[String, String]) = copy(params = params) def withWorkingDirectory(workingDirectory: Option[String]) = copy(workingDirectory = workingDirectory) - def updateEnv(name: String, value: String) = copy(env = this.env.updated(name, value)) - def addEnv(env: Map[String, String]) = copy(env = this.env ++ env) - def updateParams(name: String, value: String) = copy(params = this.params.updated(name, value)) - def addParams(params: Map[String, String]) = copy(params = this.params ++ params) + def updatedEnv(name: String, value: String) = copy(env = this.env.updated(name, value)) + def appendEnv(env: Map[String, String]) = copy(env = this.env ++ env) + def updatedParams(name: String, value: String) = copy(params = this.params.updated(name, value)) + def appendParams(params: Map[String, String]) = copy(params = this.params ++ params) // scalafmt: { maxColumn = 96 } } } @@ -183,10 +183,10 @@ object WorkflowStep { def withParams(params: Map[String, String]): Sbt def withPreamble(preamble: Boolean): Sbt - def updateEnv(name: String, value: String): Sbt - def addEnv(env: Map[String, String]): Sbt - def updateParams(name: String, value: String): Sbt - def addParams(params: Map[String, String]): Sbt + def updatedEnv(name: String, value: String): Sbt + def appendEnv(env: Map[String, String]): Sbt + def updatedParams(name: String, value: String): Sbt + def appendParams(params: Map[String, String]): Sbt } object Sbt { @@ -223,10 +223,10 @@ object WorkflowStep { def withParams(params: Map[String, String]) = copy(params = params) def withPreamble(preamble: Boolean) = copy(preamble = preamble) - def updateEnv(name: String, value: String) = copy(env = this.env.updated(name, value)) - def addEnv(env: Map[String, String]) = copy(env = this.env ++ env) - def updateParams(name: String, value: String) = copy(params = params.updated(name, value)) - def addParams(params: Map[String, String]) = copy(params = this.params ++ params) + def updatedEnv(name: String, value: String) = copy(env = this.env.updated(name, value)) + def appendEnv(env: Map[String, String]) = copy(env = this.env ++ env) + def updatedParams(name: String, value: String) = copy(params = params.updated(name, value)) + def appendParams(params: Map[String, String]) = copy(params = this.params ++ params) // scalafmt: { maxColumn = 96 } } } @@ -238,10 +238,10 @@ object WorkflowStep { def withRef(ref: UseRef): Use def withParams(params: Map[String, String]): Use - def updateEnv(name: String, value: String): Use - def addEnv(env: Map[String, String]): Use - def updateParams(name: String, value: String): Use - def addParams(params: Map[String, String]): Use + def updatedEnv(name: String, value: String): Use + def appendEnv(env: Map[String, String]): Use + def updatedParams(name: String, value: String): Use + def appendParams(params: Map[String, String]): Use } object Use { @@ -276,10 +276,10 @@ object WorkflowStep { def withRef(ref: UseRef) = copy(ref = ref) def withParams(params: Map[String, String]) = copy(params = params) - def updateEnv(name: String, value: String) = copy(env = this.env.updated(name, value)) - def addEnv(env: Map[String, String]) = copy(env = this.env ++ env) - def updateParams(name: String, value: String) = copy(params = params.updated(name, value)) - def addParams(params: Map[String, String]) = copy(params = this.params ++ params) + def updatedEnv(name: String, value: String) = copy(env = this.env.updated(name, value)) + def appendEnv(env: Map[String, String]) = copy(env = this.env ++ env) + def updatedParams(name: String, value: String) = copy(params = params.updated(name, value)) + def appendParams(params: Map[String, String]) = copy(params = this.params ++ params) // scalafmt: { maxColumn = 96 } } } From 642372e115c02761aa9e384400873d03d17ef2c9 Mon Sep 17 00:00:00 2001 From: Darren Gibson Date: Sat, 10 Aug 2024 09:55:15 -0500 Subject: [PATCH 4/7] update mima --- github-actions/mima.sbt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/github-actions/mima.sbt b/github-actions/mima.sbt index f9e6e5f8..602f0ff7 100644 --- a/github-actions/mima.sbt +++ b/github-actions/mima.sbt @@ -2,16 +2,16 @@ import com.typesafe.tools.mima.core._ mimaBinaryIssueFilters ++= Seq( "org.typelevel.sbt.gha.WorkflowJob.with*", "org.typelevel.sbt.gha.WorkflowJob.append*", - "org.typelevel.sbt.gha.WorkflowJob.update*", - "org.typelevel.sbt.gha.WorkflowStep.update*", - "org.typelevel.sbt.gha.WorkflowStep.add*", + "org.typelevel.sbt.gha.WorkflowJob.updated*", + "org.typelevel.sbt.gha.WorkflowStep.updated*", + "org.typelevel.sbt.gha.WorkflowStep.append*", "org.typelevel.sbt.gha.WorkflowStep#Sbt.with*", - "org.typelevel.sbt.gha.WorkflowStep#Sbt.add*", - "org.typelevel.sbt.gha.WorkflowStep#Sbt.update*", + "org.typelevel.sbt.gha.WorkflowStep#Sbt.append*", + "org.typelevel.sbt.gha.WorkflowStep#Sbt.updated*", "org.typelevel.sbt.gha.WorkflowStep#Run.with*", - "org.typelevel.sbt.gha.WorkflowStep#Run.add*", - "org.typelevel.sbt.gha.WorkflowStep#Run.update*", + "org.typelevel.sbt.gha.WorkflowStep#Run.append*", + "org.typelevel.sbt.gha.WorkflowStep#Run.updated*", "org.typelevel.sbt.gha.WorkflowStep#Use.with*", - "org.typelevel.sbt.gha.WorkflowStep#Use.add*", - "org.typelevel.sbt.gha.WorkflowStep#Use.update*" + "org.typelevel.sbt.gha.WorkflowStep#Use.append*", + "org.typelevel.sbt.gha.WorkflowStep#Use.updated*" ).map(ProblemFilters.exclude[ReversedMissingMethodProblem](_)) From 0cdae5c7bbbb238ee8185d4c7f6366d4d35649be Mon Sep 17 00:00:00 2001 From: Darren Gibson Date: Sat, 10 Aug 2024 10:02:10 -0500 Subject: [PATCH 5/7] Simplify mima filters, go back to 'add' from 'append' on Map fields. --- github-actions/mima.sbt | 19 ++++---------- .../org/typelevel/sbt/gha/WorkflowStep.scala | 26 +++++++++---------- 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/github-actions/mima.sbt b/github-actions/mima.sbt index 602f0ff7..a7569267 100644 --- a/github-actions/mima.sbt +++ b/github-actions/mima.sbt @@ -1,17 +1,8 @@ import com.typesafe.tools.mima.core._ mimaBinaryIssueFilters ++= Seq( - "org.typelevel.sbt.gha.WorkflowJob.with*", - "org.typelevel.sbt.gha.WorkflowJob.append*", - "org.typelevel.sbt.gha.WorkflowJob.updated*", - "org.typelevel.sbt.gha.WorkflowStep.updated*", - "org.typelevel.sbt.gha.WorkflowStep.append*", - "org.typelevel.sbt.gha.WorkflowStep#Sbt.with*", - "org.typelevel.sbt.gha.WorkflowStep#Sbt.append*", - "org.typelevel.sbt.gha.WorkflowStep#Sbt.updated*", - "org.typelevel.sbt.gha.WorkflowStep#Run.with*", - "org.typelevel.sbt.gha.WorkflowStep#Run.append*", - "org.typelevel.sbt.gha.WorkflowStep#Run.updated*", - "org.typelevel.sbt.gha.WorkflowStep#Use.with*", - "org.typelevel.sbt.gha.WorkflowStep#Use.append*", - "org.typelevel.sbt.gha.WorkflowStep#Use.updated*" + "org.typelevel.sbt.gha.WorkflowJob.*", + "org.typelevel.sbt.gha.WorkflowStep.**", + "org.typelevel.sbt.gha.WorkflowStep#Sbt.*", + "org.typelevel.sbt.gha.WorkflowStep#Run.*", + "org.typelevel.sbt.gha.WorkflowStep#Use.*" ).map(ProblemFilters.exclude[ReversedMissingMethodProblem](_)) diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala index 942dd919..65a787c0 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala @@ -30,7 +30,7 @@ sealed abstract class WorkflowStep extends Product with Serializable { def withTimeoutMinutes(minutes: Option[Int]): WorkflowStep def updatedEnv(name: String, value: String): WorkflowStep - def appendEnv(env: Map[String, String]): WorkflowStep + def addEnv(env: Map[String, String]): WorkflowStep } object WorkflowStep { @@ -127,9 +127,9 @@ object WorkflowStep { def withWorkingDirectory(workingDirectory: Option[String]): Run def updatedEnv(name: String, value: String): Run - def appendEnv(env: Map[String, String]): Run + def addEnv(env: Map[String, String]): Run def updatedParams(name: String, value: String): Run - def appendParams(params: Map[String, String]): Run + def addParams(params: Map[String, String]): Run } object Run { @@ -167,9 +167,9 @@ object WorkflowStep { def withWorkingDirectory(workingDirectory: Option[String]) = copy(workingDirectory = workingDirectory) def updatedEnv(name: String, value: String) = copy(env = this.env.updated(name, value)) - def appendEnv(env: Map[String, String]) = copy(env = this.env ++ env) + def addEnv(env: Map[String, String]) = copy(env = this.env ++ env) def updatedParams(name: String, value: String) = copy(params = this.params.updated(name, value)) - def appendParams(params: Map[String, String]) = copy(params = this.params ++ params) + def addParams(params: Map[String, String]) = copy(params = this.params ++ params) // scalafmt: { maxColumn = 96 } } } @@ -184,9 +184,9 @@ object WorkflowStep { def withPreamble(preamble: Boolean): Sbt def updatedEnv(name: String, value: String): Sbt - def appendEnv(env: Map[String, String]): Sbt + def addEnv(env: Map[String, String]): Sbt def updatedParams(name: String, value: String): Sbt - def appendParams(params: Map[String, String]): Sbt + def addParams(params: Map[String, String]): Sbt } object Sbt { @@ -224,9 +224,9 @@ object WorkflowStep { def withPreamble(preamble: Boolean) = copy(preamble = preamble) def updatedEnv(name: String, value: String) = copy(env = this.env.updated(name, value)) - def appendEnv(env: Map[String, String]) = copy(env = this.env ++ env) + def addEnv(env: Map[String, String]) = copy(env = this.env ++ env) def updatedParams(name: String, value: String) = copy(params = params.updated(name, value)) - def appendParams(params: Map[String, String]) = copy(params = this.params ++ params) + def addParams(params: Map[String, String]) = copy(params = this.params ++ params) // scalafmt: { maxColumn = 96 } } } @@ -239,9 +239,9 @@ object WorkflowStep { def withParams(params: Map[String, String]): Use def updatedEnv(name: String, value: String): Use - def appendEnv(env: Map[String, String]): Use + def addEnv(env: Map[String, String]): Use def updatedParams(name: String, value: String): Use - def appendParams(params: Map[String, String]): Use + def addParams(params: Map[String, String]): Use } object Use { @@ -277,9 +277,9 @@ object WorkflowStep { def withParams(params: Map[String, String]) = copy(params = params) def updatedEnv(name: String, value: String) = copy(env = this.env.updated(name, value)) - def appendEnv(env: Map[String, String]) = copy(env = this.env ++ env) + def addEnv(env: Map[String, String]) = copy(env = this.env ++ env) def updatedParams(name: String, value: String) = copy(params = params.updated(name, value)) - def appendParams(params: Map[String, String]) = copy(params = this.params ++ params) + def addParams(params: Map[String, String]) = copy(params = this.params ++ params) // scalafmt: { maxColumn = 96 } } } From 41f4504ce9c205533659da139b8f1beb2252c571 Mon Sep 17 00:00:00 2001 From: Darren Gibson Date: Mon, 12 Aug 2024 11:42:28 -0500 Subject: [PATCH 6/7] Change verbs, add more methods --- .../org/typelevel/sbt/gha/WorkflowJob.scala | 10 ++++--- .../org/typelevel/sbt/gha/WorkflowStep.scala | 26 +++++++++---------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala index 8901148b..4d6173ec 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala @@ -60,7 +60,9 @@ sealed abstract class WorkflowJob { def withTimeoutMinutes(timeoutMinutes: Option[Int]): WorkflowJob def updatedEnv(name: String, value: String): WorkflowJob - def appendSteps(steps: List[WorkflowStep]): WorkflowJob + def concatEnv(envs: TraversableOnce[(String, String)]): WorkflowJob + def appendedStep(step: WorkflowStep): WorkflowJob + def concatStep(suffixSteps: TraversableOnce[WorkflowStep]): WorkflowJob } object WorkflowJob { @@ -153,8 +155,10 @@ object WorkflowJob { override def withConcurrency(concurrency: Option[Concurrency]): WorkflowJob = copy(concurrency = concurrency) override def withTimeoutMinutes(timeoutMinutes: Option[Int]): WorkflowJob = copy(timeoutMinutes = timeoutMinutes) - def updatedEnv(name: String, value: String): WorkflowJob = withEnv(env.updated(name, value)) - def appendSteps(steps: List[WorkflowStep]): WorkflowJob = withSteps(this.steps ++ steps) + def updatedEnv(name: String, value: String): WorkflowJob = copy(env = env.updated(name, value)) + def concatEnv(envs: TraversableOnce[(String, String)]): WorkflowJob = copy(env = this.env ++ envs) + def appendedStep(step: WorkflowStep): WorkflowJob = copy(steps = this.steps :+ step) + def concatStep(suffixSteps: TraversableOnce[WorkflowStep]): WorkflowJob = copy(steps = this.steps ++ suffixSteps) // scalafmt: { maxColumn = 96 } override def productPrefix = "WorkflowJob" diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala index 65a787c0..9880f66d 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala @@ -30,7 +30,7 @@ sealed abstract class WorkflowStep extends Product with Serializable { def withTimeoutMinutes(minutes: Option[Int]): WorkflowStep def updatedEnv(name: String, value: String): WorkflowStep - def addEnv(env: Map[String, String]): WorkflowStep + def concatEnv(env: TraversableOnce[(String, String)]): WorkflowStep } object WorkflowStep { @@ -127,9 +127,9 @@ object WorkflowStep { def withWorkingDirectory(workingDirectory: Option[String]): Run def updatedEnv(name: String, value: String): Run - def addEnv(env: Map[String, String]): Run + def concatEnv(env: TraversableOnce[(String, String)]): Run def updatedParams(name: String, value: String): Run - def addParams(params: Map[String, String]): Run + def concatParams(params: TraversableOnce[(String, String)]): Run } object Run { @@ -167,9 +167,9 @@ object WorkflowStep { def withWorkingDirectory(workingDirectory: Option[String]) = copy(workingDirectory = workingDirectory) def updatedEnv(name: String, value: String) = copy(env = this.env.updated(name, value)) - def addEnv(env: Map[String, String]) = copy(env = this.env ++ env) + def concatEnv(env: TraversableOnce[(String, String)]) = copy(env = this.env ++ env) def updatedParams(name: String, value: String) = copy(params = this.params.updated(name, value)) - def addParams(params: Map[String, String]) = copy(params = this.params ++ params) + def concatParams(params: TraversableOnce[(String, String)]) = copy(params = this.params ++ params) // scalafmt: { maxColumn = 96 } } } @@ -184,9 +184,9 @@ object WorkflowStep { def withPreamble(preamble: Boolean): Sbt def updatedEnv(name: String, value: String): Sbt - def addEnv(env: Map[String, String]): Sbt + def concatEnv(env: TraversableOnce[(String, String)]): Sbt def updatedParams(name: String, value: String): Sbt - def addParams(params: Map[String, String]): Sbt + def concatParams(params: TraversableOnce[(String, String)]): Sbt } object Sbt { @@ -224,9 +224,9 @@ object WorkflowStep { def withPreamble(preamble: Boolean) = copy(preamble = preamble) def updatedEnv(name: String, value: String) = copy(env = this.env.updated(name, value)) - def addEnv(env: Map[String, String]) = copy(env = this.env ++ env) + def concatEnv(env: TraversableOnce[(String, String)]) = copy(env = this.env ++ env) def updatedParams(name: String, value: String) = copy(params = params.updated(name, value)) - def addParams(params: Map[String, String]) = copy(params = this.params ++ params) + def concatParams(params: TraversableOnce[(String, String)]) = copy(params = this.params ++ params) // scalafmt: { maxColumn = 96 } } } @@ -239,9 +239,9 @@ object WorkflowStep { def withParams(params: Map[String, String]): Use def updatedEnv(name: String, value: String): Use - def addEnv(env: Map[String, String]): Use + def concatEnv(env: TraversableOnce[(String, String)]): Use def updatedParams(name: String, value: String): Use - def addParams(params: Map[String, String]): Use + def concatParams(params: TraversableOnce[(String, String)]): Use } object Use { @@ -277,9 +277,9 @@ object WorkflowStep { def withParams(params: Map[String, String]) = copy(params = params) def updatedEnv(name: String, value: String) = copy(env = this.env.updated(name, value)) - def addEnv(env: Map[String, String]) = copy(env = this.env ++ env) + def concatEnv(env: TraversableOnce[(String, String)]) = copy(env = this.env ++ env) def updatedParams(name: String, value: String) = copy(params = params.updated(name, value)) - def addParams(params: Map[String, String]) = copy(params = this.params ++ params) + def concatParams(params: TraversableOnce[(String, String)]) = copy(params = this.params ++ params) // scalafmt: { maxColumn = 96 } } } From ab4311b781914b8fb4f16bf98be6a22207a0582b Mon Sep 17 00:00:00 2001 From: Darren Gibson Date: Mon, 12 Aug 2024 12:46:53 -0500 Subject: [PATCH 7/7] Apply suggestions from code review Co-authored-by: Arman Bilge --- .../src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala index 4d6173ec..515ec75e 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala @@ -62,7 +62,7 @@ sealed abstract class WorkflowJob { def updatedEnv(name: String, value: String): WorkflowJob def concatEnv(envs: TraversableOnce[(String, String)]): WorkflowJob def appendedStep(step: WorkflowStep): WorkflowJob - def concatStep(suffixSteps: TraversableOnce[WorkflowStep]): WorkflowJob + def concatSteps(suffixSteps: TraversableOnce[WorkflowStep]): WorkflowJob } object WorkflowJob { @@ -158,7 +158,7 @@ object WorkflowJob { def updatedEnv(name: String, value: String): WorkflowJob = copy(env = env.updated(name, value)) def concatEnv(envs: TraversableOnce[(String, String)]): WorkflowJob = copy(env = this.env ++ envs) def appendedStep(step: WorkflowStep): WorkflowJob = copy(steps = this.steps :+ step) - def concatStep(suffixSteps: TraversableOnce[WorkflowStep]): WorkflowJob = copy(steps = this.steps ++ suffixSteps) + def concatSteps(suffixSteps: TraversableOnce[WorkflowStep]): WorkflowJob = copy(steps = this.steps ++ suffixSteps) // scalafmt: { maxColumn = 96 } override def productPrefix = "WorkflowJob"