在多个存储库上重用 Github 个 Actions 自托管运行器

Reuse Github Actions self hosted runner on multiple repositories

我的服务器上有一个自托管 Github 操作运行器 运行,用于我的 1 个存储库。但现在我想将同一个跑步者用于另一个回购协议。

有没有一种方法可以在不需要创建新运行器的情况下将相同的 Github Actions 运行器重用于其他存储库?

更新:

从 2020 年 4 月 22 日起,这是可能的。 您现在可以在整个组织中共享跑步者。 这允许您组织内的存储库使用这些运行器。

https://github.blog/2020-04-22-github-actions-community-momentum-enterprise-capabilities-and-developer-improvements/#share-self-hosted-runners-across-an-organization

旧答案:

根据 Github 合作伙伴的说法,目前还不可能:

Currently, we have no methods to use the self-hosted runners across repositories, and also have no options to added self-hosted runners on Organization level.

来源:https://github.community/t5/GitHub-Actions/Can-one-Github-Actions-self-hosted-runner-work-for-multiple/td-p/41465

对于那些想知道我做了什么来解决这个问题的人。我在我的服务器上安装了多个 GitHub 个不同名称的运行器。不是最好的解决方案,但现在唯一可能没有肮脏的解决方法...

我们在 AWS 现货实例上使用自动缩放的自托管 github 动作运行器。

我们已将其开源:https://github.com/philips-labs/terraform-aws-github-runner

它的一位创建者制作了一个博客post,其中包含一些有关工作原理的信息:https://040code.github.io/2020/05/25/scaling-selfhosted-action-runners

一旦运行器处于活动状态,它就可以从各种存储库中获取多个构建。一段时间后,空闲的跑步者被终止。当触发新的工作流时,github 应用程序将创建一个新的运行器,该运行器将接管工作。

现在组织帐户可以创建一个 github runner 并在所有存储库中使用它。