はじめに
You only need a GitHub repository to create and run a GitHub Actions workflow. In this guide, you'll add a workflow that demonstrates some of the essential features of GitHub Actions.
The following example shows you how GitHub Actions jobs can be automatically triggered, where they run, and how they can interact with the code in your repository.
最初のワークフローを作成する
-
GitHub のリポジトリから、
github-actions-demo.ymlという名前の新しいファイルを.github/workflowsディレクトリに作成します。 詳細は「新しいファイルを作成する」を参照してください。 -
Copy the following YAML contents into the
github-actions-demo.ymlfile:YAML name: GitHub Actions Demo on: [push] jobs: Explore-GitHub-Actions: runs-on: ubuntu-latest steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - name: Check out repository code uses: actions/checkout@v2 - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - run: echo "🖥️ The workflow is now ready to test your code on the runner." - name: List files in the repository run: | ls ${{ github.workspace }} - run: echo "🍏 This job's status is ${{ job.status }}." -
Scroll to the bottom of the page and select Create a new branch for this commit and start a pull request. 次に、[Propose new file] をクリックしてPull Requestを作成します。

Committing the workflow file to a branch in your repository triggers the push event and runs your workflow.
ワークフローの結果を表示する
-
GitHubで、リポジトリのメインページにアクセスしてください。
-
リポジトリ名の下でActions(アクション)をクリックしてください。

-
左のサイドバーで、表示させたいワークフローをクリックしてください。

-
From the list of workflow runs, click the name of the run you want to see.

-
Under Jobs , click the Explore-GitHub-Actions job.

-
The log shows you how each of the steps was processed. Expand any of the steps to view its details.

For example, you can see the list of files in your repository:

さらなるワークフローテンプレート
GitHubは、カスタマイズして独自の継続的インテグレーションワークフローを作成できる、事前設定されたワークフローテンプレートを提供します。 GitHubはコードを分析し、そのリポジトリで役に立つであろうCIテンプレートを提示します。 たとえばリポジトリにNode.jsのコードが含まれているなら、Node.jsプロジェクトのためのサジェッションが提示されます。 ワークフローテンプレートは、カスタムワークフローの構築の出発点として利用することも、そのまま利用することもできます。
actions/starter-workflows リポジトリ。
次のステップ
The example workflow you just added runs each time code is pushed to the branch, and shows you how GitHub Actions can work with the contents of your repository. But this is only the beginning of what you can do with GitHub Actions:
- リポジトリには、さまざまなイベントに基づいてさまざまなジョブをトリガーする複数のワークフローを含めることができます。
- You can use a workflow to install software testing apps and have them automatically test your code on GitHub's runners.
GitHub Actions は、アプリケーション開発プロセスのほぼすべての要素を自動化するのに役立ちます。 始める準備はできましたか? GitHub Actions で次のステップに進む際に役立つ、以下のようなリソースを参照してください。
- "Learn GitHub Actions" for an in-depth tutorial.
- "Guides" for specific uses cases and examples.