Overview
If you need to share workflows and other GitHub Actions features with your team, then consider collaborating within a GitHub organization. An organization allows you to centrally store and manage secrets, artifacts, and self-hosted runners. You can also create workflow templates in the .github
repository and share them with other users in your organization.
Sharing workflows
Your organization can share workflows by reusing the workflows exactly or by creating workflow templates
Reusing workflows
You can call 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 workflow templates
Workflow templates 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 workflow template and some or all of the work of writing the workflow will be done for you. You can use workflow templates 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 workflow templates for your organization.
Sharing secrets and variables within an organization
You can centrally manage your secrets and variables within an organization, and then make them available to selected repositories. This also means that you can update a secret or variable in one location, and have the change apply to all repository workflows that use it.
When creating a secret or variable in an organization, you can use a policy to limit which repositories can access it. For example, you can grant access to all repositories, or limit access to only private repositories or a specified list of repositories.
Organization owners can create secrets or variables at the organization level.
-
On GitHub, navigate to the main page of the organization.
-
Under your organization name, click Settings. If you cannot see the "Settings" tab, select the dropdown menu, then click Settings.
-
In the "Security" section of the sidebar, select Secrets and variables, then click Actions.
-
Click the Secrets or Variables tab, and create the secret or variable with your desired values and options.
For more information, see Using secrets in GitHub Actions or Store information in variables.
Share self-hosted runners within an organization
Organization owners can add their self-hosted runners to groups, and then create policies that control which repositories can access the group.
For more information, see Managing access to self-hosted runners using groups.
Next steps
To continue learning about GitHub Actions, see Creating workflow templates for your organization.