概要
スターターワークフローを使うと、Organizationでワークフローの作成権限を持つ人は誰でも、ワークフローを素早く容易に作成できます。 新しいワークフローを作成する際に、スターターワークフローを選択すれば、ワークフローを書く作業の一部もしくは全体が行われます。 スターターワークフローは、カスタムのワークフローを構築するための出発点としても使えますし、あるいはそのまま使うこともできます。 これは時間の節約になるだけでなく、Organization全体で一貫性とベストプラクティスを促進してくれます。
GitHubは、以下の高レベルのカテゴリに対してすぐに使えるスターターワークフローを提供します。
- デプロイメント(CD)。 詳しい情報については「継続的デプロイメントについて」を参照してください。
- セキュリティ。 詳しい情報については「スターターワークフローを使ったcode scanningのセットアップ」を参照してください。
- 継続的インテグレーション(CI)。 詳細については、「継続的インテグレーションについて」を参照してください。
- 自動化。 Automationスターターワークフローは、Pull RequestのトリアージとPull Request中で変更されているパスに基づくラベルの適用、あるいはリポジトリへの初めてのコントリビューターであるユーザへの挨拶など、ワークフローを自動化するためのソリューションを提供します。
Creating a starter workflow
Starter workflows can be created by users with write access to the organization's .github
repository. These can then be used by organization members who have permission to create workflows.
Starter workflows created by users can only be used to create workflows in public repositories. Organizations using GitHub Enterprise Cloud can also use starter workflows to create workflows in private repositories. 詳しい情報についてはGitHub Enterprise Cloudのドキュメンテーションを参照してください。
Note: To avoid duplication among starter workflows you can call reusable workflows from within a workflow. This can help make your workflows easier to maintain. 詳しい情報については「ワークフローの再利用」を参照してください。
This procedure demonstrates how to create a starter workflow and metadata file. The metadata file describes how the starter workflows will be presented to users when they are creating a new workflow.
-
存在しない場合は、Organization内で
.github
という名前の新しいパブリック リポジトリを作成します。 -
workflow-templates
という名前のディレクトリを作成します。 -
workflow-templates
ディレクトリ内に新しいワークフローファイルを作成します。リポジトリのデフォルトブランチを参照する必要がある場合は、
$default-branch
プレースホルダを使用できます。 When a workflow is created the placeholder will be automatically replaced with the name of the repository's default branch.たとえば、
octo-organization-ci.yml
という名前のこのファイルは、基本的なワークフローを示しています。name: Octo Organization CI on: push: branches: [ $default-branch ] pull_request: branches: [ $default-branch ] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Run a one-line script run: echo Hello from Octo Organization
-
workflow-templates
ディレクトリ内にメタデータファイルを作成します。 メタデータ ファイルは、ワークフロー ファイルと同じ名前である必要がありますが、.yml
拡張子の代わりに、.properties.json
を付ける必要があります。 たとえばocto-organization-ci.properties.json
という名前のこのファイルには 、octo-organization-ci.yml
という名前のワークフローファイルのメタデータが含まれています。{ "name": "Octo Organization Workflow", "description": "Octo Organization CI starter workflow.", "iconName": "example-icon", "categories": [ "Go" ], "filePatterns": [ "package.json$", "^Dockerfile", ".*\\.md$" ] }
name
- Required. The name of the workflow. This is displayed in the list of available workflows.description
- Required. The description of the workflow. This is displayed in the list of available workflows.iconName
- Optional. Specifies an icon for the workflow that's displayed in the list of workflows. TheiconName
must be the name of an SVG file, without the file name extension, stored in theworkflow-templates
directory. For example, an SVG file namedexample-icon.svg
is referenced asexample-icon
.categories
- オプション。 ワークフローの言語カテゴリを定義します。 When a user views the available starter workflows for a repository, the workflows that match the identified language for the project are featured more prominently. 使用可能な言語カテゴリについては、「https://github.com/github/linguist/blob/master/lib/linguist/languages.yml」を参照してください。filePatterns
- Optional. Allows the workflow to be used if the user's repository has a file in its root directory that matches a defined regular expression.
To add another starter workflow, add your files to the same workflow-templates
directory. 例:
次のステップ
To continue learning about GitHub Actions, see "Using starter workflows."