Skip to main content

Sharing workflows, secrets, and runners with your organization

Learn how you can use organization features to collaborate with your team, by sharing workflow templates, secrets, variables, and self-hosted runners.

Overview

If you need to share workflows and other GitHub Actions features with your team, then consider collaborating within a GitHub organization. An organization allows you to centrally store and manage secrets, artifacts, and self-hosted runners. You can also create workflow templates in the .github repository and share them with other users in your organization.

Sharing actions and workflows

You can share both individual actions and entire workflows with your organization, with or without publishing the actions or workflows publicly. You can reuse actions and workflows exactly by referencing them in your workflow file, and you can create workflow templates.

Sharing actions with your enterprise

若要在不公开发布操作的情况下在整个企业中共享操作,可以将操作存储在内部存储库中,然后将存储库配置为允许访问同一组织或企业中任何组织拥有的其他存储库中的 GitHub Actions 工作流。 有关详细信息,请参阅“Sharing actions and workflows with your enterprise”。

Reusing workflows

通过从另一个工作流中调用一个工作流,可以公开或私下与组织共享工作流。 这样便可重用工作流,避免重复并使工作流更易于维护。 有关详细信息,请参阅“Reusing workflows”。

Using workflow templates

组织中所有有权创建工作流的人员可利用工作流模板,更快、更轻松地创建工作流。 创建新工作流时,你可以选择工作流模板,系统将为你完成编写工作流的部分或全部工作。 你可以使用工作流模板作为基础来构建自定义工作流,或按原样使用。 这不仅可以节省时间,而且促进了整个组织的一致性和最佳做法。 For more information, see Creating workflow templates for your organization.

Sharing secrets and variables within an organization

You can centrally manage your secrets and variables within an organization, and then make them available to selected repositories. This also means that you can update a secret or variable in one location, and have the change apply to all repository workflows that use it.

When creating a secret or variable in an organization, you can use a policy to limit which repositories can access it. For example, you can grant access to all repositories, or limit access to only private repositories or a specified list of repositories.

组织所有者和拥有“管理组织操作变量”或“管理组织操作机密”权限的用户可以在组织级别创建机密或变量。

有关详细信息,请参阅“关于自定义组织角色”。

  1. 在 GitHub 上,导航到组织的主页面。

  2. 在组织名称下,单击 “设置”****。 如果看不到“设置”选项卡,请选择“”下拉菜单,然后单击“设置”********。

    组织配置文件中选项卡的屏幕截图。 “设置”选项卡以深橙色标出。

  3. 在边栏的“安全性”部分中,选择 机密和变量,然后单击 操作

  4. Click the Secrets or Variables tab, and create the secret or variable with your desired values and options.

    For more information, see Using secrets in GitHub Actions or Store information in variables.

Share self-hosted runners within an organization

Organization owners can add their self-hosted runners to groups, and then create policies that control which repositories can access the group.

For more information, see Managing access to self-hosted runners using groups.

Next steps

To continue learning about GitHub Actions, see Creating workflow templates for your organization.