-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Change directory to the given path #563
base: master
Are you sure you want to change the base?
Conversation
index.js
Outdated
const { hasChanges } = await getLocalChanges(inputs.path); | ||
if (inputs.path) { | ||
core.debug(`Changing directory to ${inputs.path}`); | ||
process.chdir(inputs.path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a red flag? Are there other options I might use? I picked process.chdir
because runShellCommand
invokes a new terminal session each time it's run, and that defaults to the directory the code is being run from.
@gr2m before I edit the tests, are you okay with the direction here? It's worked to create PRs in another repo: octokit/go-sdk#6 Our use case here is we have a separate repository for our code generation and for where the generated code lives. Is there something I'm missing about how this could be improved (outside of removing the |
@gr2m I believe these test errors are due to my fork's GITHUB_TOKEN not having access to your repository. See these partially successful tests on my own fork. Do you have thoughts about this PR? |
I've done some more research on the test cases here, and I'm pretty confused. First, on this PR, the tests deterministically fail:Each test fails due to a 403 error attempting to create PRs on this repo. I believe pretty strongly these errors are due to the fact that this PR is from a fork, and the auto-generated GITHUB_TOKEN doesn't have access to Gregor's repo. See an example log here. On my branch cd-path on my fork with the Actions run outside the PR, the tests deterministically fail across 5 runs like so:
On the master branch on my fork, running the Actions using the workflow_dispatch trigger, the tests are deterministic across 5 runs:
See an example log here. On the master branch on the original repo here, tests are not deterministic across 5 runs but fail each time:
What next?I'm guessing that the expected failures and normal behavior is somewhere between the results of the master branches. I've proposed #595 so we can see the changes from within the repository compared to a fork. It appears the results are the same as when the Action is run from the branch on my fork. My next step will be to reason about the code further and attempt to make code changes to get the test failures closer to the test failures we see on master here. |
This PR (or #595, they're the same content) is now passing all expected tests and is ready for review! |
Provide a way to commit to other repositories, not just the one the Action is run from. Do that by allowing a Node
process.chdir
call to a given directory.