Skip to content

Conversation

@rtyley
Copy link
Member

@rtyley rtyley commented Jan 10, 2025

guardian/setup-scala has assumed that the .tool-versions file will always be in the current working directory, but that's not always the case - eg: https://github.com/guardian/janus/pull/4527

One option to get around that, I think, would be to set working-directory: when invoking guardian/setup-scala:

    - name: Install Scala
      uses: guardian/setup-scala@v1
      working-directory: janus

...but maybe allowing specific-configuration of where this specific file is located is more expressive or future-proof?

    - name: Install Scala
      uses: guardian/setup-scala@v1
      tool-versions-folder: janus

…sions` locations

`guardian/setup-scala` has assumed that the `.tool-versions` file will always be in the current
working directory, but that's not always the case - eg: guardian/janus#4527

One option to get around that, I think, would be to set `working-directory:` when invoking
`guardian/setup-scala`:

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsworking-directory

...but maybe allowing specific-configuration of where this _particular file_ is
located is more elegant or future-proof maybe?
@rtyley rtyley force-pushed the support-specifying-path-to-tool-versions branch from 80131e4 to 88fc937 Compare January 10, 2025 17:11
@rtyley rtyley requested a review from adamnfish January 10, 2025 17:14
@rtyley rtyley marked this pull request as ready for review January 10, 2025 17:14
@rtyley rtyley requested a review from a team as a code owner January 10, 2025 17:14
Copy link
Member

@davidfurey davidfurey left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me as long as Adam still thinks this is useful

@JamieB-gu
Copy link

Given that you ultimately need the path to the file rather than the folder, would it make sense to ask for that to be specified directly instead? It looks like this is a pattern common to some of the GH actions?

Copy link

@adamnfish adamnfish left a comment

Choose a reason for hiding this comment

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

Really interesting, thanks! The reason I closed the Janus PR and didn't press here for a change is that I'm not certain this action needs to do loads of work to accomodate weird edge cases like that build. I would have waitied to see if it comes up more regularly!

I actually don't hate the idea of using the working directory approach, that hadn't occurred to me! I think that makes this "regular" in a way that specifying this as bespoke configuration does not.

It looks like either approach will work with the underlying actions/setup-java (e.g. the sbt cache), so maybe we start with the no-code version for now and I try the working directory?

@rtyley
Copy link
Member Author

rtyley commented Jan 16, 2025

It looks like either approach will work with the underlying actions/setup-java (e.g. the sbt cache), so maybe we start with the no-code version for now and I try the working directory?

Sure, I'll close this PR for now!

@rtyley rtyley closed this Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants