composer-install icon indicating copy to clipboard operation
composer-install copied to clipboard

Use of `defaults.run.working-directory`

Open jbelien opened this issue 2 years ago • 7 comments

First things first, thanks a lot for this GitHub Actions workflow ! 👍

I see that there is the composer-options that allow to specify the working directory with --working-dir=foo if the composer.json file is in the foo sub-directory.

I'm using the defaults.run.working-directory in my workflow:

defaults:
  run:
    working-directory: foo/

Is there a way to make ramsey/composer-install use that defaults.run.working-directory if it is specified ?

Thanks!

jbelien avatar Oct 06 '21 10:10 jbelien

Hi, see https://github.com/ramsey/composer-install#alternate-composerjson-locations.

Using --workding-dir in your composer-options will automatically change the working directory (see related PR #107)

Kocal avatar Oct 06 '21 14:10 Kocal

Yes, that works indeed perfectly fine.

My question was about not having to specify --workding-dir in my composer-options if defaults.run.working-directory is specified. Am I missing something ?

jbelien avatar Oct 06 '21 14:10 jbelien

This is fixed in v2, please upgrade using ramsey/composer-install@v2 or ramsey/[email protected]. Details are available on the release announcement and the README.

Thanks!

ramsey avatar Dec 23 '21 19:12 ramsey

Thanks a lot @ramsey ! 👍

Will it work with defaults.run.working-directory (default configuration) or do I still need to specify working-directory as input ?

jbelien avatar Dec 24 '21 09:12 jbelien

Hmm. That's a good question. If defaults.run.working-directory tells GitHub to run everything from that directory, it should work accordingly, as long as your composer.json isn't in some place other than defaults.run.working-directory. Let me know if it doesn't work.

ramsey avatar Dec 24 '21 15:12 ramsey

Hmm. That's a good question. If defaults.run.working-directory tells GitHub to run everything from that directory, it should work accordingly, as long as your composer.json isn't in some place other than defaults.run.working-directory. Let me know if it doesn't work.

I just tried and it doesn't work if I just specify defaults.run.working-directory

Error: Unable to find composer.json at './composer.json'

I tried stuff like the following but it doesn't seem to be "supported" by GitHub Actions.

- uses: ramsey/composer-install@v2
  with:
    working-directory: ${{ defaults.run.working-directory }}

But using working-directory with the correct path in ramsey/composer-install@v2 works as expected! 👍

jbelien avatar Jan 05 '22 13:01 jbelien

Thanks for reporting back your findings. I'll need to look into this. It does make sense that it should respect the current working directory of the job.

ramsey avatar Jan 05 '22 15:01 ramsey