Skip to content
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

Copybara says 'Cannot find reference 'refs/copybara_fetch/main' and doesn't continue to run push workflow #98

Open
tosaoi0711 opened this issue Nov 9, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@tosaoi0711
Copy link

🪲 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)

  1. 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
  1. make PR topic -> main and merge
  2. 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 = [
    ],
)
@tosaoi0711 tosaoi0711 added the bug Something isn't working label Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant