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 starter workflows, secrets, and self-hosted runners.

概览

如果需要与您的团队共享工作流程和其他 GitHub Actions 功能,则考虑在 GitHub 组织内协作。 组织允许您集中存储和管理机密、构件和自托管运行器。 You can also create starter workflows 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 starter workflows that provide templates for new workflows.

Sharing actions with your enterprise

To share actions across your enterprise without publishing the actions publicly, you can store the actions in an internal repository, then configure the repository to allow access to GitHub Actions workflows in other repositories owned by the same organization or by any organization in the enterprise. For more information, see "Sharing actions and workflows with your enterprise."

Reusing workflows

You can share workflows with your organization, publicly or privately, by calling one workflow from within another workflow. This allows you to reuse workflows, avoiding duplication and making your workflows easier to maintain. For more information, see "Reusing workflows."

Using starter workflows

Starter workflows allow everyone in your organization who has permission to create workflows to do so more quickly and easily. When you create a new workflow, you can choose a starter workflow and some or all of the work of writing the workflow will be done for you. You can use starter workflows as a starting place to build your custom workflow or use them as-is. This not only saves time, it promotes consistency and best practice across your organization. For more information, see "Creating starter workflows for your organization."

在组织内共享机密

您可以在组织内集中管理您的机密,然后将其提供给选定的仓库。 这也意味着您可以在一个位置更新机密,并且将更改应用于使用该机密的所有仓库工作流程。

在组织中创建密码时,可以使用策略来限制可以访问该密码的仓库。 例如,您可以将访问权限授予所有仓库,也可以限制仅私有仓库或指定的仓库列表拥有访问权限。

要在组织级别创建密码,必须具有管理员访问权限。

  1. 在 GitHub.com 上,导航到组织的主页面。
  2. 在组织名称下,单击 设置. 组织设置按钮
  3. 在左侧边栏中,单击 Secrets(密码)
  4. 单击 New secret(新建密码)
  5. Name(名称)输入框中键入密码的名称。
  6. 输入密码的 Value(值)
  7. Repository access(仓库访问权限)下拉列表,选择访问策略。
  8. 单击 Add secret(添加密码)

在组织内共享自托管运行器

组织管理员可以将其自托管的运行器添加到组,然后创建控制哪些仓库可访问该组的策略。

更多信息请参阅“使用组管理对自托管运行器的访问”。

后续步骤

To continue learning about GitHub Actions, see "Creating starter workflows for your organization."