ノート: GitHubホストランナーは、現在GitHub Enterprise Serverでサポートされていません。 GitHubパブリックロードマップで、計画されている将来のサポートに関する詳しい情報を見ることができます。
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. If any broken links are found, the workflow uses the GitHub CLI to create a GitHub issue with the details.
以下の図は、ワークフローのステップとそれらがジョブの中で実行される様子を、高レベルの視点から描いています。
Features used in this example
サンプルのワークフローは、GitHub Actionsの以下の機能を紹介しています:
機能 | Implementation |
---|---|
定期的な間隔でワークフローを実行: | schedule |
トークンの権限を設定: | permissions |
特定の条件を満たさないかぎりジョブを実行しないようにする: | if |
ワークフロー内のシークレットを参照します: | Secrets |
リポジトリをランナーにクローン: | actions/checkout |
ノード をランナーにインストール: | actions/setup-node |
Using a third-party action: | peter-evans/create-issue-from-file |
ワークフローの例
以下のワークフローは、GitHub Docs Engineeringチームが作成しました。 github/docs
リポジトリ内のこのファイルの最新バージョンをレビューするには、次を参照してください。 check-all-english-links.yml
.
ノート: このワークフローの各行は「例を理解する」の次のセクションで説明されています。
|
Understanding the example
以下の表は、これらの機能がそれぞれGitHub Actionsワークフローの作成時にどのように使われるかを説明しています。
コード | Explanation |
---|---|
|
GitHubリポジトリの"Actions"タブに表示されるワークフローの名前。 |
|
Defines the
|
|
Modifies the default permissions granted to |
|
Groups together all the jobs that run in the workflow file. |
|
Defines a job with the ID |
|
Only run the |
|
Ubuntu Linux ランナーで実行するようにジョブを設定します。 This means that the job will execute on a fresh virtual machine hosted by GitHub. For syntax examples using other runners, see "Workflow syntax for GitHub Actions." |
|
Creates custom environment variables, and redefines the built-in |
|
Groups together all the steps that will run as part of the |
|
The |
|
This step uses the |
|
The |
|
This |
|
If the |
|
Uses the |
|
Uses
|
|
If an issue from a previous run is open and assigned to someone, then use |
|
If an issue from a previous run is open and is not assigned to anyone, then:
|
次のステップ
- GitHub Actionsの概念について学ぶには、「GitHub Actionsを理解する」を参照してください。
- 基本的なワークフローを作成するためのステップバイステップのガイドについては「GitHub Actionsのクイックスタート」を参照してください。
- GitHub Actionsの基本に慣れたなら、ワークフローとその機能について「ワークフローについて」で学べます。