Skip to main content

此版本的 GitHub Enterprise 已停止服务 2022-06-03. 即使针对重大安全问题,也不会发布补丁。 要获得更好的性能、改进的安全性和新功能,请升级到 GitHub Enterprise 的最新版本。 如需升级方面的帮助,请联系 GitHub Enterprise 支持

Disabling or limiting GitHub Actions for your organization

Organization owners can disable, enable, and limit GitHub Actions for an organization.

注: GitHub 托管的运行器目前在 GitHub Enterprise Server 上不受支持。 您可以在 GitHub 公共路线图 上查看有关未来支持计划的更多信息。

About GitHub Actions permissions for your organization

默认情况下,GitHub Actions 在 您的 GitHub Enterprise Server 实例 上启用后,它 将在所有仓库和组织上启用。 You can choose to disable GitHub Actions or limit it to actions in your enterprise. For more information about GitHub Actions, see "About GitHub Actions."

You can enable GitHub Actions for all repositories in your organization. When you enable GitHub Actions, workflows are able to run actions located within your repository and any other public or internal repository. You can disable GitHub Actions for all repositories in your organization. 禁用 GitHub Actions 时,仓库中不会运行任何工作流程。

Alternatively, you can enable GitHub Actions for all repositories in your organization but limit the actions a workflow can run.

Managing GitHub Actions permissions for your organization

You can choose to disable GitHub Actions for all repositories in your organization, or only allow specific repositories. You can also limit the use of public actions, so that people can only use local actions that exist in your enterprise.

Note: You might not be able to manage these settings if your organization is managed by an enterprise that has overriding policy. For more information, see "Enforcing policies for GitHub Actions in your enterprise."

  1. 在 GitHub Enterprise Server 的右上角,单击您的头像,然后单击 Your organizations(您的组织)个人资料菜单中的组织

  2. 在组织旁边,单击 Settings(设置)设置按钮

  3. In the left sidebar, click Actions.

  4. Under "Policies", select an option.

    If you choose Allow select actions, actions within your enterprise are allowed, and there are additional options for allowing other specific actions. For more information, see "Allowing select actions to run."

Set actions policy for this organization

  1. Click Save.

允许所选操作 运行

选择 Allow select actions 时,允许本地操作 ,并且还有其他选项可用于允许其他特定操作:

  • 允许 GitHub 创建的操作: 您可以允许 GitHub 创建的所有操作用于工作流程。 GitHub 创建的操作位于 actionsgithub 组织中。 更多信息请参阅 actionsgithub 组织。

  • 允许已验证的创建者执行市场操作: 此选项在您启用 GitHub Connect 并配置了 GitHub Actions 时可用。 更多信息请参阅“使用 GitHub Connect 启用对 GitHub.com 操作的自动访问”。 您可以允许工作流程使用由经过验证的创建者创建的所有 GitHub Marketplace 操作。 如果 GitHub 验证该操作的创建者为合作伙伴组织, 徽� 将显示在 GitHub Marketplace 中的操作旁边。

  • 允许指定的操作: 可以将工作流程限制为使用特定组织和存储库中的操作。

    要限制对特定� �记的访问或者操作 的提交 SHA,请使用工作流中使用的相同语法来选择操作。

    • 对于操作,语法为 <OWNER>/<REPO>@<TAG OR SHA>。 例如,使用 actions/javascript-action@v1.0.1 选择� �记,或使用 actions/javascript-action@172239021f7ba04fe7327647b213799853a9eb89 选择 SHA。 更多信息请参阅“查找和自定义操作”。

    您可以使用 * 通配符来匹配模式。 例如,要允许以 space-org 开头的组织中的所有操作,可以指定 space-org*/*。 要允许以 octocat 开头的存储库中的所有操作 ,可以使用 */octocat**@*。 有关使用 * 通配符的更多信息,请参阅“GitHub Actions 的工作流程语法”。

此过程演示如何将特定操作 添� 到允许列表中。

  1. 在 GitHub Enterprise Server 的右上角,单击您的头像,然后单击 Your organizations(您的组织)个人资料菜单中的组织

  2. 在组织旁边,单击 Settings(设置)设置按钮

  3. In the left sidebar, click Actions.

  4. Under "Policies", select Allow select actions and add your required actions to the list.

    Add actions to the allow list

  5. Click Save.

Enabling workflows for private repository forks

如果您依赖于使用私有仓库的复刻,您可以配置策略来控制用户如何在 pull_request 事件上运行工作流程。 Available to private and internal repositories only, you can configure these policy settings for your enterprise, organizations, or repositories.

If a policy is disabled for an enterprise, it cannot be enabled for organizations. If a policy is disabled for an organization, it cannot be enabled for repositories. If an organization enables a policy, the policy can be disabled for individual repositories.

  • Run workflows from fork pull requests(从复刻拉取请求运行工作流程) - 允许用户使用具有只读权限、没有密� �访问权限的 GITHUB_TOKEN从复刻拉取请求运行工作流程。
  • Send write tokens to workflows from pull requests(从拉取请求向工作流程发送写入令牌) - 允许从复刻拉取请求以使用具有写入权限的 GITHUB_TOKEN
  • Send secrets to workflows from pull requests(从拉取请求向工作流程发送密� �) - 使所有密� �可用于拉取请求。

Configuring the private fork policy for an organization

  1. 在 GitHub Enterprise Server 的右上角,单击您的头像,然后单击 Your organizations(您的组织)个人资料菜单中的组织
  2. 在组织旁边,单击 Settings(设置)设置按钮
  3. In the left sidebar, click Actions.
  4. Fork pull request workflows(复刻拉取请求工作流程)下,选择您的选项。 例如: 启用、禁用或限制此仓库的操作
  5. 单击 Save(保存)以应用设置。