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 "Understanding GitHub Actions."
If you enable GitHub Actions, any organization on your GitHub Enterprise Server instance 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 "Disabling or limiting GitHub Actions for your organization."
Enforcing a policy to restrict the use of 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.
-
In the top-right corner of GitHub Enterprise Server, click your profile photo, then click Enterprise settings.
-
In the enterprise sidebar, click Policies.
-
Under " Policies", click Actions.
-
Under "Policies", select your options.
You can choose which organizations in your enterprise can use GitHub Actions, and you can restrict access to public actions.
Note: To enable access to public actions, you must first configure your GitHub Enterprise Server instance to connect to GitHub Marketplace. For more information, see "Enabling automatic access to GitHub.com actions using GitHub Connect."
-
Click Save.
Allowing select actions to run
When you choose Allow select actions, local actions are allowed, and there are additional options for allowing other specific actions:
-
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 specified actions: You can restrict workflows to use actions in specific organizations and repositories.
To restrict access to specific tags or commit SHAs of an action, use the same
<OWNER>/<REPO>@<TAG OR SHA>
syntax used in the workflow to select the action. For example,actions/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."You can use the
*
wildcard character to match patterns. For example, to allow all actions in organizations that start withspace-org
, you can specifyspace-org*/*
. To add all actions in repositories that start with octocat, you can use*/octocat*@*
. For more information about using the*
wildcard, see "Workflow syntax for GitHub Actions."
This procedure demonstrates how to add specific actions to the allow list.
-
In the top-right corner of GitHub Enterprise Server, click your profile photo, then click Enterprise settings.
-
In the enterprise sidebar, click Policies.
-
Under " Policies", click Actions.
-
Under Policies, select Allow select actions and add your required actions to the list.
Enforcing a policy for artifact and log retention in your enterprise
GitHub Actions can store artifact and log files. For more information, see "Downloading workflow artifacts."
By default, the artifacts and log files generated by workflows are retained for 90 days before they are automatically deleted. You can adjust the retention period, depending on the type of repository:
-
For public repositories: you can change this retention period to anywhere between 1 day or 90 days.
-
For private and internal repositories: you can change this retention period to anywhere between 1 day or 400 days.
When you customize the retention period, it only applies to new artifacts and log files, and does not retroactively apply to existing objects. For managed repositories and organizations, the maximum retention period cannot exceed the limit set by the managing organization or enterprise.
-
In the top-right corner of GitHub Enterprise Server, click your profile photo, then click Enterprise settings.
-
In the enterprise sidebar, click Policies.
-
Under " Policies", click Actions.
-
Under Artifact and log retention duration, enter a new value.
-
Click Save to apply the change.
Enforcing a policy for fork pull requests in your enterprise
You can enforce policies to control how GitHub Actions behaves for your GitHub Enterprise Server instance when members of your enterprise run workflows from forks.
Enforcing a policy for fork pull requests in private repositories
If you rely on using forks of your private repositories, you can configure policies that control how users can run workflows on pull_request
events. Available to private and internal repositories only, you can configure these policy settings for your enterprise, organizations, or repositories.
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.
- Run workflows from fork pull requests - Allows users to run workflows from fork pull requests, using a
GITHUB_TOKEN
with read-only permission, and with no access to secrets. - Send write tokens to workflows from pull requests - Allows pull requests from forks to use a
GITHUB_TOKEN
with write permission. - Send secrets to workflows from pull requests - Makes all secrets available to the pull request.
-
In the top-right corner of GitHub Enterprise Server, click your profile photo, then click Enterprise settings.
-
In the enterprise sidebar, click Policies.
-
Under " Policies", click Actions.
-
Under Fork pull request workflows, select your options. For example:
-
Click Save to apply the settings.