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

Failed to build fork private repo (PR) #812

Open
Nir-Az opened this issue Apr 17, 2023 · 9 comments
Open

Failed to build fork private repo (PR) #812

Nir-Az opened this issue Apr 17, 2023 · 9 comments
Labels
bug Something isn't working

Comments

@Nir-Az
Copy link

Nir-Az commented Apr 17, 2023

Hi,

I am trying to get action-ros-ci to build PR's (origin from the form to the main repo) on a private repo.
I currently get an error on this stage:

Invoking: bash -c,vcs import --force --recursive src/ < package.repo

I followed the guide and added this line:

- name: build ROS 2 application
        uses: ros-tooling/action-ros-ci@v0.3
        with:
          import-token: ${{ secrets.GITHUB_TOKEN }}

And I get this error:

 Could not determine ref type of version: remote: Repository not found.

Any idea why?

yaml file:

name: build_lrs_ROS2_package

on:
  push:
    branches: ['**']
  pull_request:
    branches: ['**']

jobs:

  build_ros2_package:
    runs-on: ubuntu-latest

    container:
      image: ${{ matrix.docker_image }}
    steps:

      - name: setup environment
        uses: ros-tooling/setup-ros@v0.6
        with:
          required-ros-distributions: humble

      - name: build
        uses: ros-tooling/action-ros-ci@v0.3
        with:
          import-token: ${{ secrets.GITHUB_TOKEN }}
          target-ros2-distro: humble

@Nir-Az Nir-Az added the bug Something isn't working label Apr 17, 2023
@Nir-Az Nir-Az changed the title Failed to build private repo Failed to build fork private repo (PR) Apr 17, 2023
@christophebedard
Copy link
Member

Can you try the following?

  1. Go to https://github.com/$user/$repo/settings/actions (replace $user and $repo). Under "Workflow permissions," select "Read and write permissions." This might already be selected. Not sure why this option would fix this, but you never know.
  2. Create your own personal access token and add it as a secret: https://github.com/ros-tooling/action-ros-ci#Use-with-private-repos. If this private repo is under an organisation, you might need to create a special token, I don't remember how that works.

I can give it a try on my end with a private repo, but probably not today.

@Nir-Az
Copy link
Author

Nir-Az commented Apr 17, 2023

Thanks.

I tried "1" , didn't help.
2 is harder since it's an org, and according to action-ros-ci docs is not needed since we do not have private dependencies..
So I would prefer to wait and see your reproduction..

Or if you have other tips that might fix it..

Thanks,
Nir

@christophebedard
Copy link
Member

2 is harder since it's an org, and according to action-ros-ci docs is not needed since we do not have private dependencies..

Yeah it used to work fine, but these token permissions seem to change all the time 😐

@Nir-Az
Copy link
Author

Nir-Az commented Apr 18, 2023

According to this line :

repoFullName = github.context.payload.pull_request.head.repo.full_name;

I think you try to clone the PR source repo and not the target PR repo, sounds right?
According to GitHub actions documentation

head means the source repo (which is not the workfile repo)
and base is the target repo.
The action is running againt the target repo and the token is valid for the target repo.

@Nir-Az
Copy link
Author

Nir-Az commented Apr 18, 2023

@timor-raiman FYI

@christophebedard
Copy link
Member

Good observation.

Sounds like you have two private repos, and you use one as a fork (repo B) and open pull requests against the other one (repo A). Is that correct? My recommendation would be to not fork a private repo, but I guess that doesn't help you much.

Does it work if you use this change then? timor-raiman@c3757c1. I don't think it does (at least not for all cases), because cloning the target repo with a commit hash belonging to the source repo doesn't work.

@Nir-Az
Copy link
Author

Nir-Az commented Apr 18, 2023

Correct, forking the private repo and trying to PR from the fork to the main
@timor-raiman is trying to help with changes to your code..
Hopefully we can find a fix and you can review & merge it..

@christophebedard
Copy link
Member

Of course, improvements and fixes are always welcome!

@timor-raiman
Copy link

If dirk-thomas/vcstool#258 can be fixed, #816 would resolve this...

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

3 participants