Skip to content
This repository was archived by the owner on Aug 2, 2023. It is now read-only.

Add workdir and repository as input vars#79

Closed
n3ph wants to merge 3 commits intorepo-sync:masterfrom
commercetools:add-workdir
Closed

Add workdir and repository as input vars#79
n3ph wants to merge 3 commits intorepo-sync:masterfrom
commercetools:add-workdir

Conversation

@n3ph
Copy link
Contributor

@n3ph n3ph commented Mar 19, 2022

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.

Signed-off-by: Michael Gerlach <michael.gerlach@commercetools.com>
Signed-off-by: Michael Gerlach <michael.gerlach@commercetools.com>
@fundthmcalculus
Copy link

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

@heiskr heiskr requested a review from a team November 28, 2022 16:14
@wei
Copy link
Member

wei commented Dec 24, 2022

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.

@chayim
Copy link

chayim commented Jan 3, 2023

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

@chayim
Copy link

chayim commented Jan 4, 2023

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.

@wei
Copy link
Member

wei commented Jan 21, 2023

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

@infogulch
Copy link

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

@n3ph
Copy link
Contributor Author

n3ph commented May 20, 2023

Never saw #69 (comment) 🙈

Sorry for the noise...

@n3ph n3ph closed this May 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants