ros-tooling/action-ros-ci

Running Actions in forked repos

Closed this issue · 1 comments

When someone wants to contribute to our repos from a forked repo, the tests will fail.
Initial report in ros-tooling/setup-ros2#16 duplicated below.


Noticed this issue in ros-tooling/cross_compile#37.

In this PR, the base branch is from a fork of the repo where the action runs.
PR base branch: https://github.com/aws-ros-dev/cross_compile/tree/allabana/doc-fixes
Main repo: https://github.com/ros-tooling/cross_compile

Instead of cloning the fork and checking out the source branch, the action looks for the branch in the parent repo. When it is unable to find the branch, the test errors out.

Test log output:

repositories:
  cross_compile:
    type: git
    url: "https://github.com/ros-tooling/cross_compile.git"
    version: "allabana/doc-fixes"
EOF
=== src/cross_compile (git) ===
Could not checkout ref 'allabana/doc-fixes': error: pathspec 'allabana/doc-fixes' did not match any file(s) known to git
##[error]The process 'bash' failed with exit code 1
##[error]Node run failed with exit code 1

According to this document:

Workflows do not run on private base repositories when you open a pull request from a forked repository.

It explains that github actions must be turned in the forked repo. Reason it doesn't occur automatically is because there are some secrets that need to be transferred which is not safe.

Further discussion here.

As you were mentioning, your fork is in aws-ros-dev but the VCS url is set to ros-tooling/cross_complie, so the branch can't be found, which is why it is failing.
We just need to fix the script to pull the right repo in VCS.

This line is wrong: https://github.com/ros-tooling/action-ros2-ci/blob/master/src/action-ros2-ci.ts#L50