Open
Description
🪲 Bug report
Summary
Copybara stops its process with error 'Cannot find reference 'refs/copybara_fetch/main' even running the copybara-action after GitHub checkout action (actions/checkout@v3
). Tuning on the actions debug flag and download the generated copy.bara.sky file and running the same push operation locally with cloning the origin repo worked fine. The issue only happens run the copybara though the copybara-action.
Expected behavior
Copybara runs push operation successfully
Actual behavior
Copybara stops push operation with the error
Steps to reproduce the problem
Prerequisites:
source: our private monorepo on GitHub (default branch is main
)
target: our private sub repository GitHub (default branch is main
)
- Add Github Actions file with the folloging config
name: test
on:
pull_request:
...
push:
branches:
- main
paths:
- <our monorepo subdir to be copied to target>
jobs:
sync:
name: Sync
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Olivr/[email protected]
with:
ssh_key: ${{ secrets.SSH_KEY }}
access_token: ${{ secrets.GH_TOKEN }}
sot_repo: <our private monorepo>
destination_repo: <our private sub-repo>
push_include: "<our monorepo subdir to be copied to target>"
pr_move: |
||<our monorepo subdir to be copied to target>
copybara_options: --force --init-history
- make PR topic ->
main
and merge - Run actions triggered by push to
main
Environment
- Github Actions
- Running action on ubuntu-latest
- Version:
v1.2.3
Possible fix
- Using custom config and specify remote source of truth instead of local SOT resolves the issue so I suspect something happens
on using local SOT.
core.workflow(
name = "push",
origin = git.github_origin(
url = "[email protected]:<sot_repo_name>.git",
ref = "main",
),
destination = git.destination(
url = "[email protected]:<target_repo_name>.git",
fetch = "main",
push = "main",
),
origin_files = glob(["<path>/**"]),
destination_files = glob(["**"]),
authoring = authoring.pass_thru("github-actions<[email protected]>"),
transformations = [
],
)