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

Custom working directory #7

Closed
renyuneyun opened this issue Jun 25, 2023 · 11 comments · Fixed by #21
Closed

Custom working directory #7

renyuneyun opened this issue Jun 25, 2023 · 11 comments · Fixed by #21

Comments

@renyuneyun
Copy link

Hi. Is there a way to set a custom working directory when using this workflow?

This SO answer points out a way, but it does not work well with the workflow, because the directory does not exist before workflow run.

@LeoDiazL
Copy link
Contributor

Hi there @renyuneyun ! Thanks for opening up an issue with us!

Let me know if I understood you correctly.

You need to specify a path where the npm ci and the other build commands are going to be executed. Is that correct?

Is the example below what you would like to set up?

- name: Clean temp directory
  run: rm -rf *
  working-directory: ./temp

If so, at the moment, we don't have a way to set the working-directory. But we can look up to implement this in the short term if needed.

If you need more help from us, feel free to contact us through Discord!!

@mickmcgrath13
Copy link
Contributor

@renyuneyun Is this still an issue?

You could also try something like build_command: cd /some/path && npm run build

@LeoDiazL
Copy link
Contributor

LeoDiazL commented Jan 4, 2024

Closing the issue due to inactivity. Feel free to reopen the issue if needed.

@LeoDiazL LeoDiazL closed this as completed Jan 4, 2024
@thenick775
Copy link

Just bumping. I too would like this feature, especially for a monorepo setup where I typically sparse checkout only the required service!

Either that or just allowing for sparse checkouts might be nice 😎

@mickmcgrath13
Copy link
Contributor

maybe something like this?
#21

@mickmcgrath13
Copy link
Contributor

@thenick775 and @renyuneyun mind giving it a go when you get a sec? I put up the PR, but i've not had a chance to test it.

@LeoDiazL
Copy link
Contributor

LeoDiazL commented May 8, 2024

Hi @thenick775 and @renyuneyun!

We have this PR that solves your request. We would love to see if you have any other inputs for us before this makes it to a release.

Thanks again for your involvement!

@thenick775
Copy link

I'll try to get some eyes on this in the next few days, unless someone can beat me to it! 😎

@thenick775
Copy link

thenick775 commented May 16, 2024

@LeoDiazL checked this out and the options look good, but is there a way we can make the default working directory the directory that has been checked out using the sparse checkout?

Really what I'm trying to avoid is having to specify both of these in addition to sparse checkout commands if that's possible:

install_command: cd ./gbajs3 && npm ci
path: ./gbajs3/dist

I think its been brought up before, so not sure if we can support, I usually get around this by setting a default working-directory, with a cd in a step as a last resort:

defaults:
  run:
    working-directory: ./gbajs3

Ex.
workflow: https://github.com/thenick775/gbajs3/actions/runs/9120572660/job/25078169773
action yml: https://github.com/thenick775/gbajs3/blob/32f87cea7d8a43479d09f739c59f6b4114a93192/.github/workflows/deploy-pages.workflow.yml

The sparse checkout itself is working 😎

I don't think this necessarily solves the initial ask, but definitely satisfies part of mine.

@LeoDiazL
Copy link
Contributor

@thenick775 sorry for the late response.

About the comment, would be nice, but there's a catch.

 Do a sparse checkout on given patterns. Each pattern should be separated with new lines.

Adding that option might not apply to everybody.

If you are reusing and would like to reduce the amount of variables to adjust, you could define an environment variable that helps define the three variables at the same time. (Docs about variables here )

Or you could even wrap our action inside one of you own creation, doing this merge automatically.

Let me know your thoughts, and if I can merge/close this. (once that's done a new release will follow).

Leo

@thenick775
Copy link

That is a very fair point!

This definitely saves me enough with allowing for integrated sparse checkouts, I'm happy to close!

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 a pull request may close this issue.

4 participants