Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

PR cannot be found when --github-use-repo is specified. #257

Open
ghost opened this issue Sep 15, 2023 · 2 comments
Open

PR cannot be found when --github-use-repo is specified. #257

ghost opened this issue Sep 15, 2023 · 2 comments

Comments

@ghost
Copy link

ghost commented Sep 15, 2023

Hello,

I have the following workflow (simplified):

core.workflow(
    name = "import-pr",
    authoring = …,
    origin = git.github_pr_origin(
        url = "git@github.com:thb-sb/myproject.git",
    ),
    mode = "CHANGE_REQUEST",
    transformations = […],
)

When I call copybara with this workflow, Copybara is able to find the revision for a given PR 1337:

$ bazel run @com_github_google_copybara//java/com/google/copybara -- migrate $PWD/my/copy.bara.sky -v import-pr 1337
Task: GitHub PR Origin: Resolving reference 1337
INFO: Executing GET repos/%s/pulls/%d
Task: Fetching Pull Request 1337 and branch 'main'

However, if I overwrite the url attribute of my import-pr workflow, it suddently fails to find the revision:

$ bazel run @com_github_google_copybara//java/com/google/copybara -- migrate $PWD/my/copy.bara.sky -v --github-use-repo git@github.com:thb-sb/myproject.git import-pr 1337
…
Task: Git Origin: Initializing local repo
ERROR: Cannot find reference(s): [1337, refs/tags/*

It seems that when --github-use-repo is used, Copybara doesn't GET repos/%s/pulls/%d. I think that way because the following logs aren't display when --github-use-repo is used, when they are without:

Task: GitHub PR Origin: Resolving reference 1337
INFO: Executing GET repos/%s/pulls/%d
Task: Fetching Pull Request 1337 and branch 'main'

Am I missing or misusing something here?

@ghost
Copy link
Author

ghost commented Mar 7, 2024

up.

@mikelalcon
Copy link
Collaborator

Yes, when an url is used it doesn't execute any of the GitHub path. I think it makes sense that it did for forks (or find another similar mechanism)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant