Skip to content

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

Open
@tosaoi0711

Description

@tosaoi0711

🪲 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 = [
    ],
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions