pull-request icon indicating copy to clipboard operation
pull-request copied to clipboard

Add workdir and repository as input vars

Open n3ph opened this issue 3 years ago • 1 comments

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.

n3ph avatar Mar 19 '22 01:03 n3ph

Upvoting this @hrtshu . I've run into exactly this same issue. Thanks for the fix @n3ph !

fundthmcalculus avatar Oct 11 '22 13:10 fundthmcalculus

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 avatar Dec 24 '22 01:12 wei

@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:

chayim avatar Jan 03 '23 13:01 chayim

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.

chayim avatar Jan 04 '23 09:01 chayim

I recommend merging in the latest master which will provide more verbose logging for ease of troubleshooting.

wei avatar Jan 21 '23 16:01 wei

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

infogulch avatar Mar 20 '23 00:03 infogulch

Never saw https://github.com/repo-sync/pull-request/pull/69#issuecomment-1364433705 🙈

Sorry for the noise...

n3ph avatar May 20 '23 00:05 n3ph