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 more with*, update*, and add* for Workflow step and jobs. #732

Merged
merged 7 commits into from
Aug 13, 2024

Conversation

zarthross
Copy link
Contributor

Not sure how often and when these will be used, but I found wanting another with, so I took the time to add some more helpers.

github-actions/mima.sbt Outdated Show resolved Hide resolved
@armanbilge
Copy link
Member

I think these methods are useful. I'm not certain about the naming conventions. T equivalent methods on the underlying collections use past tense e.g. updated, appended, ... with the exception of concat 🤷

@zarthross
Copy link
Contributor Author

I think these methods are useful. I'm not certain about the naming conventions. T equivalent methods on the underlying collections use past tense e.g. updated, appended, ... with the exception of concat 🤷

@armanbilge
Alright, so I switched update to updated, but do you want me to change append to appended? What do you want me to change add to ? added?

@@ -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 updatedEnv(name: String, value: String): WorkflowJob = withEnv(env.updated(name, value))
def appendSteps(steps: List[WorkflowStep]): WorkflowJob = withSteps(this.steps ++ steps)
Copy link
Member

@armanbilge armanbilge Aug 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method name append is inconsistent (in both name and signature) with appended. https://www.scala-lang.org/api/current/scala/collection/immutable/List.html#appended-957

(Although it looks like the 2.12 standard library doesn't have named aliases for these methods.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed append to appended and made it take a single step. Added concatStep with a TraversableOnce for added flexibility.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also changed add* to concat* for consistency.

Copy link
Member

@armanbilge armanbilge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for iterating!

@armanbilge armanbilge merged commit e384990 into typelevel:main Aug 13, 2024
14 checks passed
@zarthross zarthross deleted the with-more branch August 19, 2024 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants