Add workdir and repository as input vars
For cross-repository workflows we required to checkout repositories to sub-directories in order to commit and push changes to a different repository / branch. In order to be able to create a PR, I've added these two inputs.
Upvoting this @hrtshu . I've run into exactly this same issue. Thanks for the fix @n3ph !
Thanks for the PR!
GitHub Actions currently provide the ability to set working directory for a job at https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_iddefaultsrun
Can this method along with #69 satisfy your use-case? The reason being that way, you have the flexibility to run other actions too without the need to change code of other actions you or others might want to run in the future.
@wei In my case this fix is exactly what I need. I have blocks of code that clone multiple repositories, generate code into each one, etc. After a series of tests/heuristics and other things happen.. I want to push pull requests to several repositories.
To do so, I in turn rely on multiple repositories being cloned. This would be a game changer for me :pray:
Actually @n3ph I'm not convinced this works. In my test setup - using your fork it appears that the option isn't honoured. In my example I:
- Check out repo 1 to path foo
- Checkout repo 2 to path bar
- ..... (generate code into bar)
- Run this.
What happens is that even though I'm in the correct directory (I receive the text Changing working directory to python) the PR attempts to push to my current repository, and hence fails.
More interesting, it doesn't error (HTTP 422 though), so it returns green.
I recommend merging in the latest master which will provide more verbose logging for ease of troubleshooting.
GitHub Actions currently provide the ability to set working directory ... [ref
working-directory:] -- @wei
That only works with the run step, it does not work with other workflow actions. Note that all of the referenced docs about working-directory specifically refer to the run step. Each action must explicitly implement this functionality itself.
Here is what happens if you try to provide the working-directory input to the pull-request action:
Warning: Unexpected input(s) 'working-directory', valid inputs are ['entryPoint', 'args', 'destination_repository', 'source_branch', 'destination_branch', 'pr_title', 'pr_body', 'pr_template', 'pr_reviewer', 'pr_assignee', 'pr_label', 'pr_milestone', 'pr_draft', 'pr_allow_empty', 'github_token', 'debug'] -- https://github.com/infogulch/foam/actions/runs/4463559871/jobs/7838896887
Never saw https://github.com/repo-sync/pull-request/pull/69#issuecomment-1364433705 🙈
Sorry for the noise...