Manually trigger a build from a fork

Hey all

I have been trying to trigger a build from a fork of the repository upon manual trigger. I have looked into API and CLI tried to create the build but it returned client error 404: {"message":"Not Found"} for a fork but successfully starts the build for the main repository itself.

We will use this for making users to be able to build without creating a PR. Then we will use the artifacts built for deploying to a developer environment.

There is a workaround we are using, that triggering the build on the main repository master and cloning the forked repo by passing remote and branch as parameters. But it has downsides on its own.

I was hoping to make sure if this is possible or not. If not is there a way you can think of to make it work. For example I’m thinking of calling /hook endpoint like a PR, but not sure if it will work.

All of the other triggers are working, PRs, pushes, tags etc. We are using self hosted droneci. Here is the repository configuration.

{
        "user_id": 1,
        "namespace": "main",
        "name": "be",
        "slug": "main/be",
        "scm": "",
        "git_http_url": "https://github.com/main/be.git",
        "git_ssh_url": "git@github.com:main/be.git",
        "link": "https://github.com/main/be",
        "default_branch": "master",
        "private": true,
        "visibility": "private",
        "active": true,
        "config_path": ".drone.yml",
        "trusted": true,
        "protected": false,
        "ignore_forks": false,
        "ignore_pull_requests": false,
        "auto_cancel_pull_requests": true,
        "auto_cancel_pushes": true,
        "auto_cancel_running": false,
        "timeout": 60,
        ...
    },

The only approach I can think of is for the user to enable Drone for their fork, which would allow them to manually trigger the pipeline.

1 Like