Nathanmalnoury / gh-backport-action

Github action to backport PR.
MIT License
2 stars 4 forks source link

git_setup not working anymore? #11

Closed chambm closed 2 years ago

chambm commented 2 years ago

I just tried to use this action again after not using it for a while and I'm getting an odd failure:

/usr/bin/docker run --name cd98f3c84ac33cc6c4f72b92a734c7dfb[0](https://github.com/ProteoWizard/pwiz/runs/7118491438?check_suite_focus=true#step:4:1)08e_2ac793 --label 4cd98f --workdir /github/workspace --rm -e INPUT_PR_BRANCH -e INPUT_PR_TITLE -e INPUT_GITHUB_TOKEN -e INPUT_PR_BODY -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e GITHUB_STEP_SUMMARY -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/pwiz/pwiz":"/github/workspace" 4cd98f:3c84ac33cc6c4f72b92a734c7dfb008e  "Skyline/skyline_21_2" "Automatic cherry pick of #{pr_number} from {base_branch} to {pr_branch}" "An automated backport for #{pr_number}." "***"

Traceback (most recent call last):
  File "/action/helpers.py", line 17, in git
    command_run = subprocess.run(["git", *args], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True)
  File "/usr/local/lib/python[3](https://github.com/ProteoWizard/pwiz/runs/7118491438?check_suite_focus=true#step:4:4).8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', 'remote', 'set-url', '--push', 'origin', '***github.com/ProteoWizard/pwiz.git']' returned non-zero exit status 128.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/action/main.py", line 70, in <module>
    git_setup(args.github_token)
  File "/action/helpers.py", line 5, in git_setup
    git(
  File "/action/helpers.py", line 2, in git
    raise GitException(output)
helpers.GitException: fatal: unsafe repository ('/github/workspace' is owned by someone else)

Any idea what's going wrong here?

Nathanmalnoury commented 2 years ago

Hey !

I've had a similar issue on another action, I think it's a change since a vulnerability was discovered in git. A similar issue happened there, if that may help https://github.com/repo-sync/pull-request/issues/84

chambm commented 2 years ago

Great, adding that before the repo clone in git_setup fixed the error. Thanks!