Cross repository events

Say I have two repositories, A and B. I’d like a workflow to run in B whenever a PR in A is merged. So I essentially want an event trigger that can listen for events in a different repository. Is that possible?

Right now I see two workarounds: a) I could have a workflow in A that pushes a custom notification to B whenever a PR is merged in A. The main downside of that is that I would need an access token for B stored in A, which for the scenario I have in mind is not practical. b) I could run a scheduled workflow in B that periodically checks for closed PRs in A. That would work, but it would waste _a lot_ of resources (github resources, I guess), and there would be a delay. But the upside of that is that the owner of repository A doesn’t need to do anything to participate in this story (which is important for the scenario I have in mind).

Is there another way to do this?

If not, is that a feature that could be added?

8 Likes

We’d encourage you to use a repository dispatch event to coordinate these workflows, but yes, that would require an access token configured as a secret.

The issue is that you often don’t have control over the upstream repo. The typical use case is that you want to auto-update your sources when a new library or container image that your application depends on is released.

It would be great if GitHub provides cross repository release events, e.g. like this:

    on:

      release:

        # Trigger whenever a new Node.js 12 version is released

        - repo: nodejs/node

          patten: ‘^12.([0-9]+)*$’

14 Likes