Example overview
この記事では、サンプルのワークフローを使ってGitHub ActionsのCIの主な機能の一部を紹介しています。 When this workflow is triggered, it automatically runs a script that checks whether the GitHub Docs site has any broken links.
以下の図は、ワークフローのステップとそれらがジョブの中で実行される様子を、高レベルの視点から描いています。
Features used in this example
サンプルのワークフローは、GitHub Actionsの以下の機能を紹介しています:
機能 | Implementation |
---|---|
自動的に実行されるワークフローのトリガー: | push |
自動的に実行されるワークフローのトリガー: | pull_request |
UIからワークフローを手動で実行: | workflow_dispatch |
トークンの権限を設定: | permissions |
同時に実行できるワークフローの実行もしくはジョブ数を制御: | concurrency |
Running the job on different runners, depending on the repository: | runs-on |
リポジトリをランナーにクローン: | actions/checkout |
ノード をランナーにインストール: | actions/setup-node |
Using a third-party action: | trilom/file-changes-action |
ワークフローの例
以下のワークフローは、GitHub Docs Engineeringチームが作成しました。 github/docs
リポジトリ内のこのファイルの最新バージョンをレビューするには、次を参照してください。 link-check-all.yml
.
ノート: このワークフローの各行は「例を理解する」の次のセクションで説明されています。
|
Understanding the example
以下の表は、これらの機能がそれぞれGitHub Actionsワークフローの作成時にどのように使われるかを説明しています。
コード | Explanation |
---|---|
|
GitHubリポジトリの"Actions"タブに表示されるワークフローの名前。 |
|
The |
|
Add the |
|
Add the |
|
Add the |
|
Modifies the default permissions granted to |
|
Creates a concurrency group for specific events, and uses the |
|
Cancels any currently running job or workflow in the same concurrency group. |
|
Groups together all the jobs that run in the workflow file. |
|
Defines a job with the ID |
|
Configures the job to run on a GitHub-hosted runner or a self-hosted runner, depending on the repository running the workflow. In this example, the job will run on a self-hosted runner if the repository is named |
|
Groups together all the steps that will run as part of the |
|
The |
|
This step uses the |
|
The |
|
Uses the |
|
Lists the contents of |
|
This step uses |
|
This step also uses |
次のステップ
- GitHub Actionsの概念について学ぶには、「GitHub Actionsを理解する」を参照してください。
- 基本的なワークフローを作成するためのステップバイステップのガイドについては「GitHub Actionsのクイックスタート」を参照してください。
- GitHub Actionsの基本に慣れたなら、ワークフローとその機能について「ワークフローについて」で学べます。