google / google/copybara

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

Open
#257 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
3.8k
Forks
345
PR merge metrics
No merged PRs in 30d

Description

Hello,

I have the following workflow (simplified):

```starlark
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`:

```bash
$ 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:

```bash
$ 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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.