リポジトリの GitHub Actions 権限について
By default, GitHub Actions is enabled on all repositories and organizations. You can choose to disable GitHub Actions or limit it to actions and reusable workflows in your enterprise. GitHub Actions の詳細は、「GitHub Actionsについて」を参照してください。
リポジトリで GitHub Actions を有効化できます。 When you enable GitHub Actions, workflows are able to run actions and reusable workflows located within your repository and any other public or internal repository. リポジトリの GitHub Actions を完全に無効化することができます。 GitHub Actionsを無効化すると、リポジトリでワークフローが実行されなくなります。
Alternatively, you can enable GitHub Actions in your repository but limit the actions and reusable workflows a workflow can run.
リポジトリの GitHub Actions 権限を管理する
You can disable GitHub Actions for a repository, or set a policy that configures which actions and reusable workflows can be used in the repository.
注釈: Organization に優先ポリシーがあるか、優先ポリシーのある Enterprise アカウントによって管理されている場合、これらの設定を管理できない場合があります。 For more information, see "Disabling or limiting GitHub Actions for your organization" or "Enforcing policies for GitHub Actions in your enterprise."
-
GitHub.comで、リポジトリのメインページにアクセスしてください。
-
リポジトリ名の下で Settings(設定)をクリックしてください。
-
In the left sidebar, click Actions, then click General.
-
[Actions permissions] で、オプションを選択します。
If you choose Allow enterprise, and select non-enterprise, actions and reusable workflows, actions and reusable workflows within your enterprise are allowed, and there are additional options for allowing other specific actions and reusable workflows. For more information, see "Allowing select actions and reusable workflows to run."
When you allow actions and reusable workflows from only in your enterprise, the policy blocks all access to actions authored by GitHub. For example, the
actions/checkout
action would not be accessible. -
[Save] をクリックします。
Allowing select actions and reusable workflows to run
When you choose Allow enterprise, and select non-enterprise, actions and reusable workflows, local actions and reusable workflows are allowed, and there are additional options for allowing other specific actions and reusable workflows:
-
Allow actions created by GitHub: You can allow all actions created by GitHub to be used by workflows. Actions created by GitHub are located in the
actions
andgithub
organizations. For more information, see theactions
andgithub
organizations. -
Allow Marketplace actions by verified creators: You can allow all GitHub Marketplace actions created by verified creators to be used by workflows. When GitHub has verified the creator of the action as a partner organization, the badge is displayed next to the action in GitHub Marketplace.
-
Allow specified actions and reusable workflows: You can restrict workflows to use actions and reusable workflows in specific organizations and repositories.
To restrict access to specific tags or commit SHAs of an action or reusable workflow, use the same syntax used in the workflow to select the action or reusable workflow.
- For an action, the syntax is
<OWNER>/<REPO>@<TAG OR SHA>
. For example, useactions/javascript-action@v1.0.1
to select a tag oractions/javascript-action@172239021f7ba04fe7327647b213799853a9eb89
to select a SHA. For more information, see "Finding and customizing actions." - For a reusable workflow, the syntax is
<OWNER>/<REPO>/<PATH>/<FILENAME>@<TAG OR SHA>
. For example,octo-org/another-repo/.github/workflows/workflow.yml@v1
. For more information, see "Reusing workflows."
You can use the
*
wildcard character to match patterns. For example, to allow all actions and reusable workflows in organizations that start withspace-org
, you can specifyspace-org*/*
. To allow all actions and reusable workflows in repositories that start with octocat, you can use*/octocat**@*
. For more information about using the*
wildcard, see "Workflow syntax for GitHub Actions."Note: The Allow specified actions and reusable workflows option is only available in public repositories with the GitHub Free, GitHub Pro, GitHub Free for organizations, or GitHub Team plan.
- For an action, the syntax is
This procedure demonstrates how to add specific actions and reusable workflows to the allow list.
-
GitHub.comで、リポジトリのメインページにアクセスしてください。
-
リポジトリ名の下で Settings(設定)をクリックしてください。
-
In the left sidebar, click Actions, then click General.
-
Under "Actions permissions", select Allow enterprise, and select non-enterprise, actions and reusable workflows and add your required actions to the list.
-
[Save] をクリックします。
パブリックフォークからのワークフローに対する必須の承認の設定
パブリックリポジトリをフォークし、リポジトリのGitHub Actionsワークフローへの変更を提案するPull Requestをサブミットすることは誰でもできます。 フォークからのワークフローはシークレットなどの機密データにアクセスできませんが、悪用目的で変更された場合、メンテナが迷惑を被る可能性があります。
これを防ぐために、外部コラボレータのパブリックリポジトリへのPull Requestではワークフローは自動的には動作せず、まず承認が必要になることがあります。 デフォルトでは、すべての初めてのコントリビューターは、ワークフローを実行するのに承認を必要とします。
Note: Workflows triggered by pull_request_target
events are run in the context of the base branch. Since the base branch is considered trusted, workflows triggered by these events will always run, regardless of approval settings.
You can configure this behavior for a repository using the procedure below. Modifying this setting overrides the configuration set at the organization or enterprise level.
-
GitHub.comで、リポジトリのメインページにアクセスしてください。
-
リポジトリ名の下で Settings(設定)をクリックしてください。
-
In the left sidebar, click Actions, then click General.
-
Fork pull request workflows from outside collaborators(外部コラボレーターからのPull Requestワークフローのフォーク)の下で、オプションを選択してください。 このオプションは、制限が緩いものから厳しいものへとリストされています。
-
Save(保存)をクリックして、設定を適用してください。
このポリシーが適用されるワークフローの実行の承認に関する詳しい情報については「パブリックフォークからのワークフローの実行の承認」を参照してください
プライベートリポジトリのフォークのワークフローを有効にする
プライベートリポジトリのフォークの利用に依存しているなら、ユーザがどのようにpull_request
イベントの際にワークフローを実行できるかを制御するポリシーを設定できます。 Available to private and internal repositories only, you can configure these policy settings for enterprises, organizations, or repositories.
If a policy is disabled for an enterprise or organization, it cannot be enabled for a repository.
- Run workflows from fork pull requests(フォークのPull Requestからワークフローを実行) - 読み取りのみの権限を持ち、シークレットにはアクセスできない
GITHUB_TOKEN
を使って、フォークのPull Requestからワークフローを実行することをユーザに許可します。 - Send write tokens to workflows from pull requests(Pull Requestから書き込みトークンをワークフローに送信) - 書き込み権限を持つ
GITHUB_TOKEN
の利用をフォークからのPull Requestに許可します。 - Send secrets to workflows from pull requests(Pull Requestからワークフローにシークレットを送信) - すべてのシークレットをPull Requestから利用可能にします。
リポジトリのプライベートフォークポリシーを設定する
- GitHub.comで、リポジトリのメインページにアクセスしてください。
- リポジトリ名の下で Settings(設定)をクリックしてください。
- In the left sidebar, click Actions, then click General.
- Fork pull request workflows(Pull Requestワークフローのフォーク)の下で、オプションを選択してください。 例:
- Save(保存)をクリックして、設定を適用してください。
Setting the permissions of the GITHUB_TOKEN
for your repository
GITHUB_TOKEN
に付与されるデフォルトの権限を設定できます。 For more information about the GITHUB_TOKEN
, see "Automatic token authentication." You can choose a restricted set of permissions as the default, or apply permissive settings.
The default permissions can also be configured in the organization settings. If your repository belongs to an organization and a more restrictive default has been selected in the organization settings, the same option is selected in your repository settings and the permissive option is disabled.
リポジトリに対して書き込みアクセス権を持つ人は、ワークフローファイル中のpermissions
キーを編集することによって、GITHUB_TOKEN
に付与される権限を変更したり、必要に応じてアクセス権を追加したり削除したりできます。 詳しい情報については権限
を参照してください。
デフォルトのGITHUB_TOKEN
権限の設定
By default, when you create a new repository in your personal account, GITHUB_TOKEN
only has read access for the contents
scope. If you create a new repository in an organization, the setting is inherited from what is configured in the organization settings.
-
GitHub.comで、リポジトリのメインページにアクセスしてください。
-
リポジトリ名の下で Settings(設定)をクリックしてください。
-
In the left sidebar, click Actions, then click General.
-
[Workflow permissions]の下で、
GITHUB_TOKEN
にすべてのスコープに対する読み書きアクセスを持たせたいか、あるいはcontents
スコープに対する読み取りアクセスだけを持たせたいかを選択してください。 -
Save(保存)をクリックして、設定を適用してください。
GitHub ActionsがPull Requestの作成もしくは承認をできないようにする
You can choose to allow or prevent GitHub Actions workflows from creating or approving pull requests.
By default, when you create a new repository in your personal account, workflows are not allowed to create or approve pull requests. If you create a new repository in an organization, the setting is inherited from what is configured in the organization settings.
-
GitHub.comで、リポジトリのメインページにアクセスしてください。
-
リポジトリ名の下で Settings(設定)をクリックしてください。
-
In the left sidebar, click Actions, then click General.
-
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. -
Save(保存)をクリックして、設定を適用してください。
Allowing access to components in an internal repository
Members of your enterprise can use internal repositories to work on projects without sharing information publicly. For information, see "About repositories."
You can use the steps below to configure whether actions and workflows in an internal repository can be accessed from outside the repository. For more information, see "Sharing actions and workflows with your enterprise." Alternatively, you can use the REST API to set, or get details of, the level of access. For more information, see "Get the level of access for workflows outside of the repository" and "Set the level of access for workflows outside of the repository."
-
On GitHub, navigate to the main page of the internal repository.
-
Under your repository name, click Settings.
-
In the left sidebar, click Actions, then click General.
-
Under Access, choose one of the access settings:
- Not accessible - Workflows in other repositories cannot access this repository.
- Accessible from repositories in the 'ORGANIZATION NAME' organization - Workflows in other repositories that are part of the 'ORGANIZATION NAME' organization can access the actions and workflows in this repository. Access is allowed only from private or internal repositories.
- Accessible from repositories in the 'ENTERPRISE NAME' enterprise - Workflows in other repositories that are part of the 'ENTERPRISE NAME' enterprise can access the actions and workflows in this repository. Access is allowed only from private or internal repositories.
-
Save(保存)をクリックして、設定を適用してください。
Configuring the retention period for GitHub Actions artifacts and logs in your repository
リポジトリ内の GitHub Actions アーティファクトとログの保持期間を設定できます。
デフォルトでは、ワークフローによって生成された成果物とログファイルは、90日間保持された後自動的に削除されます。 この保持の期間は、リポジトリの種類によって調整できます。
- パブリックリポジトリの場合: この保持時間を1日から90日の間で変更できます。
- For private and internal repositories: you can change this retention period to anywhere between 1 day or 400 days.
保持期間をカスタマイズした場合、適用されるのは新しい成果物とログファイルに対してであり、既存のオブジェクトにさかのぼっては適用されません。 管理されたリポジトリ及びOrganizationについては、最大の保持期間は管理するOrganizationあるいはEnterpriseによって設定された上限を超えることはできません。
ワークフローによって作成された特定のアーティファクトのカスタム保存期間を定義することもできます。 詳しい情報については、「アーティファクトの保持期間を設定する」を参照してください。
リポジトリの保持期間を設定する
- GitHub.comで、リポジトリのメインページにアクセスしてください。
- リポジトリ名の下で Settings(設定)をクリックしてください。
- In the left sidebar, click Actions, then click General.
- Under Artifact and log retention, enter a new value.
- Save(保存)をクリックして、変更を適用してください。