Skip to main content

Enforcing policies for GitHub Actions in your enterprise

You can enforce policies for GitHub Actions within your enterprise's organizations, or allow policies to be set in each organization.

この機能を使用できるユーザーについて

Enterprise owners can enforce policies for GitHub Actions in an enterprise.

About policies for GitHub Actions in your enterprise

GitHub Actions helps members of your enterprise automate software development workflows on GitHub Enterprise Server. For more information, see "GitHub Actions を理解する."

If you enable GitHub Actions, any organization on お使いの GitHub Enterprise Server インスタンス can use GitHub Actions. You can enforce policies to control how members of your enterprise on GitHub Enterprise Server use GitHub Actions. By default, organization owners can manage how members use GitHub Actions. For more information, see "Organization について GitHub Actions を無効化または制限する."

Enforcing a policy to restrict the use of GitHub Actions in your enterprise

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

  1. GitHub Enterprise Server の右上で、ご自分のプロフィール フォトをクリックしてから、 [Enterprise 設定] をクリックします。

    GitHub Enterprise Server のプロファイル写真をクリックしたときに表示されるドロップダウン メニューのスクリーンショット。 [エンタープライズ設定] オプションが濃いオレンジ色の枠線で強調表示されています。

  2. Enterprise アカウントのサイドバーで、 [ポリシー] をクリックします。

  3. ポリシー」で、[アクション] をクリックします。

  4. Under "Policies", select your options.

    [Allow select actions](選択したアクションを許可する) を選択した場合、エンタープライズ内のアクションが許可され、追加のオプションで、その他の特定のアクションも許可されます。 詳細については、「選択したアクションの実行の許可」を参照してください。

    Note: To enable access to public actions, you must first configure お使いの GitHub Enterprise Server インスタンス to connect to GitHub.com. For more information, see "Enabling automatic access to GitHub.com actions using GitHub Connect."

  5. Click Save.

選択したアクションの実行の許可

[ [Allow select actions](選択したアクションを許可する) ] を選ぶと、ローカル アクションが許可され、他の特定のアクションを許可するための追加のオプションがあります。

注: 組織に優先ポリシーがある場合、または優先ポリシーのあるエンタープライズによって管理されている場合は、これらの設定を管理できない場合があります。 詳細については、「Organization について GitHub Actions を無効化または制限する」または「Enforcing policies for GitHub Actions in your enterprise」を参照してください。

  • [GitHub によって作成されたアクションを許可する]: GitHub によって作成されたすべてのアクションを、ワークフローで使用できるようにします。 GitHub によって作成されたアクションは、actions および github 組織にあります。 詳しくは、actions および github の Organization をご覧ください。

  • [検証済みの作成者による Marketplace アクションを許可する]: このオプションは、GitHub Connect が有効になっていて、GitHub Actions で構成されている場合に使用できます。 詳細については「Enabling automatic access to GitHub.com actions using GitHub Connect」を参照してください。 検証済みの作成者が作成したすべての GitHub Marketplace アクションをワークフローで使用できるようにできます。 GitHubがアクションの作者をパートナーOrganizationとして検証すると、GitHub Marketplaceでアクションの隣にバッジが表示されるようになります。

  • [指定したアクションを許可する]: ワークフローで使用できるアクションを、特定の組織とリポジトリのものに制限します。 指定されたアクションを 1000 を超えるアクションに設定することはできません。

    アクションの特定のタグまたはコミット SHA へのアクセスを制限するには、ワークフローで使われているのと同じ構文を使って、アクションを選びます。

    • アクションの場合の構文は、OWNER/REPOSITORY@TAG-OR-SHA です。 たとえば、タグを選択するには actions/javascript-action@v1.0.1 を使用し、SHA を選択するには actions/javascript-action@a824008085750b8e136effc585c3cd6082bd575f を使用します。 詳しくは、「アクションの検索とカスタマイズ」を参照してください。

    パターンのマッチには、ワイルドカード文字 * を使用できます。 たとえば、space-org で始まる Organization のすべてのアクションを許可するには、space-org*/* と指定できます。 octocat で始まるリポジトリのすべてのアクションを許可するには、*/octocat**@* を使用できます。 * ワイルドカードの使用の詳細については、「ギットハブ アクション のワークフロー構文」を参照してください。

この手順では、特定のアクションを許可リストに追加する方法を示します。

  1. GitHub Enterprise Server の右上で、ご自分のプロフィール フォトをクリックしてから、 [Enterprise 設定] をクリックします。

    GitHub Enterprise Server のプロファイル写真をクリックしたときに表示されるドロップダウン メニューのスクリーンショット。 [エンタープライズ設定] オプションが濃いオレンジ色の枠線で強調表示されています。

  2. Enterprise アカウントのサイドバーで、 [ポリシー] をクリックします。

  3. ポリシー」で、[アクション] をクリックします。

  4. Under "Policies", select [Allow select actions](選択したアクションを許可する) and add your required actions to the list.

Disabling repository-level self-hosted runners

GitHub Enterprise Server のセルフホステッド ランナーが一時的でクリーンな仮想マシンでホストされる保証はありません。 その結果、ワークフロー内の信頼できないコードによって侵害される可能性があります。

同様に、リポジトリをフォークしてプル リクエストを開くことができるユーザー (通常は、リポジトリへの読み取りアクセス権を持つユーザー) は、セルフホステッド ランナー環境を侵害する可能性があります。それには、シークレットへのアクセスや、リポジトリへの書き込みアクセス権を設定に応じて付与できる GITHUB_TOKEN の取得が含まれます。 ワークフローは、環境と必要なレビューを使用して環境シークレットへのアクセスを制御できますが、これらのワークフローは分離された環境では実行されず、セルフホストランナーで実行した場合でも同じリスクの影響を受けやすくなります。

このような理由やその他の理由から、ユーザーがリポジトリ レベルでセルフホステッド ランナーを作成できないようにすることができます。 For more information on creating self-hosted runners at the repository level, see "自己ホストランナーの追加."

By default anyone with admin access to a repository can add a self-hosted runner for the repository. The enterprise settings allow you to disable the use of repository-level self-hosted runners across all repositories in your enterprise. If you allow repository-level self-hosted runners for your enterprise, organization owners can choose to allow or prevent creation of repository-level self-hosted runners for some or all repositories in their organization. For more information see, "Organization について GitHub Actions を無効化または制限する."

: セルフホステッド ランナーがリポジトリ レベルで作成できなくなっている場合でも、ワークフローは Enterprise レベルまたは Organization レベルで設定されたセルフホステッド ランナーにアクセスできます。

  1. GitHub Enterprise Server の右上で、ご自分のプロフィール フォトをクリックしてから、 [Enterprise 設定] をクリックします。

    GitHub Enterprise Server のプロファイル写真をクリックしたときに表示されるドロップダウン メニューのスクリーンショット。 [エンタープライズ設定] オプションが濃いオレンジ色の枠線で強調表示されています。

  2. Enterprise アカウントのサイドバーで、 [ポリシー] をクリックします。

  3. ポリシー」で、[アクション] をクリックします。

  4. In the "Runners" section, select Disable for all organizations.

  5. Click Save to apply the change.

Enforcing a policy for artifact and log retention in your enterprise

GitHub Actions can store artifact and log files. For more information, see "ワークフローの成果物をダウンロードする."

デフォルトでは、ワークフローによって生成された成果物とログファイルは、90日間保持された後自動的に削除されます。 この保持時間を 1 から 400 日の間で変更できます。

保持期間をカスタマイズした場合、適用されるのは新しい成果物とログファイルに対してであり、既存のオブジェクトにさかのぼっては適用されません。 管理されたリポジトリ及びOrganizationについては、最大の保持期間は管理するOrganizationあるいはEnterpriseによって設定された上限を超えることはできません。

  1. GitHub Enterprise Server の右上で、ご自分のプロフィール フォトをクリックしてから、 [Enterprise 設定] をクリックします。

    GitHub Enterprise Server のプロファイル写真をクリックしたときに表示されるドロップダウン メニューのスクリーンショット。 [エンタープライズ設定] オプションが濃いオレンジ色の枠線で強調表示されています。

  2. Enterprise アカウントのサイドバーで、 [ポリシー] をクリックします。

  3. ポリシー」で、[アクション] をクリックします。

  4. [成果物、ログ、キャッシュの設定] セクションの [成果物とログの保持] に、新しい値を入力します。

  5. [保存] をクリックして変更を適用します。

Enforcing a policy for fork pull requests in your enterprise

You can enforce policies to control how GitHub Actions behaves for お使いの GitHub Enterprise Server インスタンス when members of your enterprise run workflows from forks.

Enforcing a policy for fork pull requests in private repositories

プライベート リポジトリのフォークの利用に依存している場合、pull_request イベントの際にユーザーがどのようにワークフローを実行できるかを制御するポリシーを構成できます。 プライベート リポジトリと内部リポジトリでのみ使用でき、Enterprise、Organization、またはリポジトリに対してこれらのポリシー設定を構成できます。

If a policy is enabled for an enterprise, the policy can be selectively disabled in individual organizations or repositories. If a policy is disabled for an enterprise, individual organizations or repositories cannot enable it.

  • フォーク pull request からワークフローを実行する - 読み取り専用権限を持ち、シークレットへのアクセス権を持たない GITHUB_TOKEN を使用して、フォーク pull request からワークフローを実行できます。
  • pull request からワークフローに書き込みトークンを送信する - フォークからの pull request で書き込み権限を持つ GITHUB_TOKEN を使用できます。
  • pull request からワークフローにシークレットを送信する - すべてのシークレットを pull request で利用できるようにします。
  • フォークの pull request ワークフローに対して承認を要求する - 書き込みアクセス許可のないコラボレーターからの pull request に対するワークフロー実行には、実行する前に書き込みアクセス許可を持つ誰かからの承認が必要になります。
  1. GitHub Enterprise Server の右上で、ご自分のプロフィール フォトをクリックしてから、 [Enterprise 設定] をクリックします。

    GitHub Enterprise Server のプロファイル写真をクリックしたときに表示されるドロップダウン メニューのスクリーンショット。 [エンタープライズ設定] オプションが濃いオレンジ色の枠線で強調表示されています。

  2. Enterprise アカウントのサイドバーで、 [ポリシー] をクリックします。

  3. ポリシー」で、[アクション] をクリックします。

  4. [Fork pull request workflows](pull request ワークフローのフォーク) で、オプションを選択します。

  5. [保存] をクリックして設定を適用します。

Enforcing a policy for workflow permissions in your enterprise

GITHUB_TOKEN に付与される既定のアクセス許可を設定できます。 GITHUB_TOKEN について詳しくは、「自動トークン認証」をご覧ください。 デフォルトとして制限付きアクセス許可セットを選択するか、より幅広く許可をする設定を適用できます。

You can set the default permissions for the GITHUB_TOKEN in the settings for your enterprise, organizations, or repositories. If you choose a restricted option as the default in your enterprise settings, this prevents the more permissive setting being chosen in the organization or repository settings.

リポジトリへの書き込みアクセス権を持っている人は誰でも、ワークフロー ファイルの permissions キーを編集して、GITHUB_TOKEN に付与されたアクセス許可を変更でき、必要に応じて追加または削除できます。 詳細については、permissions をご覧ください。

Configuring the default GITHUB_TOKEN permissions

By default, when you create a new enterprise, GITHUB_TOKEN only has read access for the contents and packages scopes.

  1. GitHub Enterprise Server の右上で、ご自分のプロフィール フォトをクリックしてから、 [Enterprise 設定] をクリックします。

    GitHub Enterprise Server のプロファイル写真をクリックしたときに表示されるドロップダウン メニューのスクリーンショット。 [エンタープライズ設定] オプションが濃いオレンジ色の枠線で強調表示されています。

  2. Enterprise アカウントのサイドバーで、 [ポリシー] をクリックします。

  3. ポリシー」で、[アクション] をクリックします。

  4. [ワークフローのアクセス許可] で、GITHUB_TOKEN に対してすべてのスコープでの読み取りと書き込みアクセスを許可するか (制限の緩い設定)、contents スコープと packages スコープでの読み取りアクセスのみを許可するか (制限された設定) を選びます。

  5. Click Save to apply the settings.

Preventing GitHub Actions from creating or approving pull requests

GitHub Actions ワークフローが pull request を作成または承認することを許可または禁止するかを選択できます。

By default, when you create a new enterprise, workflows are not allowed to create or approve pull requests.

  1. GitHub Enterprise Server の右上で、ご自分のプロフィール フォトをクリックしてから、 [Enterprise 設定] をクリックします。

    GitHub Enterprise Server のプロファイル写真をクリックしたときに表示されるドロップダウン メニューのスクリーンショット。 [エンタープライズ設定] オプションが濃いオレンジ色の枠線で強調表示されています。

  2. Enterprise アカウントのサイドバーで、 [ポリシー] をクリックします。

  3. ポリシー」で、[アクション] をクリックします。

  4. Under "Workflow permissions", use the Allow GitHub Actions to create and approve pull requests setting to configure whether GITHUB_TOKEN can create and approve pull requests.

  5. Click Save to apply the settings.

Enforcing a policy for cache storage in your enterprise

既定では、GitHub Actions が お使いの GitHub Enterprise Server インスタンス 用の外部ストレージで使用するキャッシュ ストレージの合計は、リポジトリあたり最大 10 GB に制限され、リポジトリに設定できる最大サイズは 25 GB です。 この制限を超えると、GitHub は新しいキャッシュを保存しますが、合計サイズがリポジトリの制限を下回るまでキャッシュの削除を開始します。

However, you can set an enterprise policy to customize both the default total cache size for each repository, as well as the maximum total cache size allowed for a repository. For example, you might want the default total cache size for each repository to be 5 GB, but also allow organization owners and repository administrators to configure a total cache size up to 15 GB if necessary.

Organization owners can set a lower total cache size that applies to each repository in their organization. People with admin access to a repository can set a total cache size for their repository up to the maximum cache size allowed by the enterprise or organization policy setting.

  1. GitHub Enterprise Server の右上で、ご自分のプロフィール フォトをクリックしてから、 [Enterprise 設定] をクリックします。

    GitHub Enterprise Server のプロファイル写真をクリックしたときに表示されるドロップダウン メニューのスクリーンショット。 [エンタープライズ設定] オプションが濃いオレンジ色の枠線で強調表示されています。

  2. Enterprise アカウントのサイドバーで、 [ポリシー] をクリックします。

  3. ポリシー」で、[アクション] をクリックします。

  4. In the "Artifact, log, and cache settings" section, under Maximum cache size limit, enter a value, then click Save to apply the setting.

  5. In the "Artifact, log, and cache settings" section, under Default cache size limit, enter a value, then click Save to apply the setting.