Skip to content

Commit 7b7cec6

Browse files
authored
repo sync
2 parents 5b76b0f + 355f074 commit 7b7cec6

1 file changed

Lines changed: 69 additions & 79 deletions

File tree

Lines changed: 69 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,139 +1,129 @@
11
---
2-
title: 複合実行ステップ アクションの作成
3-
intro: 'このガイドでは、複合実行ステップ アクションを構築する方法について説明します。'
2+
title: Creating a composite run steps action
3+
intro: 'In this guide, you''ll learn how to build a composite run steps action.'
44
product: '{% data reusables.gated-features.actions %}'
55
versions:
66
free-pro-team: '*'
77
enterprise-server: '>=2.22'
88
---
99

10-
{% data variables.product.prodname_actions %} の支払いを管理する
11-
{% data variables.product.prodname_dotcom %}は、macOSランナーのホストに[MacStadium](https://www.macstadium.com/)を使用しています。
10+
{% data reusables.actions.enterprise-beta %}
11+
{% data reusables.actions.enterprise-github-hosted-runners %}
1212

13-
### はじめに
13+
### Introduction
1414

15-
このガイドでは、パッケージ化された複合実行ステップ アクションを作成および使用するために必要な基本的なコンポーネントについて説明します。 アクションのパッケージ化に必要なコンポーネントのガイドに焦点を当てるため、アクションのコードの機能は最小限に留めます。 アクションは「ハローワールド」と「さよなら」を印刷するか、カスタム名を指定すると「こんにちは [who-to-greet]」と「さようなら」を出力します。 このアクションでは、乱数も `乱数` 出力変数にマップされ、 `goodbye.sh`という名前のスクリプトが実行されます。
15+
In this guide, you'll learn about the basic components needed to create and use a packaged composite run steps action. To focus this guide on the components needed to package the action, the functionality of the action's code is minimal. The action prints "Hello World" and then "Goodbye", or if you provide a custom name, it prints "Hello [who-to-greet]" and then "Goodbye". The action also maps a random number to the `random-number` output variable, and runs a script named `goodbye.sh`.
1616

17-
このプロジェクトを完了したら、独自の複合実行ステップ アクションをビルドし、ワークフローでテストする方法を理解する必要があります。
17+
Once you complete this project, you should understand how to build your own composite run steps action and test it in a workflow.
1818

19-
### 必要な環境
19+
### Prerequisites
2020

21-
始める前に、{% data variables.product.product_name %} リポジトリを作成します。
21+
Before you begin, you'll create a {% data variables.product.product_name %} repository.
2222

23-
1. {% data variables.product.product_location %} に新しいパブリックリポジトリを作成します。 任意のリポジトリ名を選択するか、hello-world コンポジット実行ステップアクション</code> 例 `次の方法を使用できます。 これらのファイルは、プロジェクトを {% data variables.product.product_name %}にプッシュした後で追加できます。 詳しい情報については、「<a href="/articles/creating-a-new-repository">新しいリポジトリの作成</a>」を参照してください。</p></li>
24-
<li><p spaces-before="0">リポジトリをお手元のコンピューターにクローンします。 詳しい情報については<a href="/articles/cloning-a-repository">リポジトリのクローン</a>を参照してください。</p></li>
25-
<li><p spaces-before="0">ターミナルから、ディレクトリを新しいリポジトリに変更します。
26-
<pre><code class="shell"> cd ハローワールドコンポジット実行ステップアクション
27-
`</pre>
23+
1. Create a new public repository on {% data variables.product.product_location %}. You can choose any repository name, or use the following `hello-world-composite-run-steps-action` example. You can add these files after your project has been pushed to {% data variables.product.product_name %}. For more information, see "[Create a new repository](/articles/creating-a-new-repository)."
2824

29-
2. `hello-world-composite-run-steps-action` リポジトリで、 `goodbye.sh`という名前の新しいファイルを作成し、次のコード例を追加します。
25+
1. Clone your repository to your computer. For more information, see "[Cloning a repository](/articles/cloning-a-repository)."
3026

27+
1. From your terminal, change directories into your new repository.
28+
29+
```shell
30+
cd hello-world-composite-run-steps-action
31+
```
32+
33+
2. In the `hello-world-composite-run-steps-action` repository, create a new file called `goodbye.sh`, and add the following example code:
34+
3135
```bash
32-
エコー"さようなら"
36+
echo "Goodbye"
3337
```
3438

35-
3. ターミナルから、`goodbye.sh` を実行可能にします。
39+
3. From your terminal, make `goodbye.sh` executable.
3640

3741
```shell
3842
chmod +x goodbye.sh
3943
```
4044

41-
1. 端末から、 `goodbye.sh` ファイルをチェックインします。
45+
1. From your terminal, check in your `goodbye.sh` file.
4246
```shell
43-
git を追加goodbye.sh
44-
git コミット -m "さよならスクリプトを追加"
45-
git プッシュ
47+
git add goodbye.sh
48+
git commit -m "Add goodbye script"
49+
git push
4650
```
4751

48-
### アクションのメタデータファイルの作成
52+
### Creating an action metadata file
4953

50-
1. `hello-world-composite-run-steps-action` リポジトリで、action.yml</code> `という名前の新しいファイルを作成し、次のコード例を追加します。 この構文の詳細については、「<a href="/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions"><code>実行` 」を参照</a>してください。
54+
1. In the `hello-world-composite-run-steps-action` repository, create a new file called `action.yml` and add the following example code. For more information about this syntax, see "[`runs` for a composite run steps](/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions)".
5155

5256
{% raw %}
53-
**アクション.yml**
57+
**action.yml**
5458
```yaml
55-
name:Hello World
56-
の説明:「 誰かに挨拶する」
57-
入力:
58-
誰が挨拶する:入力
59-
説明の#id:「誰を迎えるか」が必要
60-
です:true
61-
デフォルト
62-
:
63-
デフォルト:
64-
の乱数:説明:${{ steps.random-number-generator.outputs.random-id }}
65-
66-
:
67-
使用:
68-
69-
- 実行:エコーこんにちは{{ inputs.who-to-greet }}
70-
シェル: バッシュ
71-
- id: 乱数ジェネレータ
72-
実行: echo "::セット出力名=ランダム id::$(エコー $RANDOM)"
73-
シェル: バッシュ
74-
- 実行: ${{ github.action_path }}/goodbye.sh
75-
シェル: bash
59+
name: 'Hello World'
60+
description: 'Greet someone'
61+
inputs:
62+
who-to-greet: # id of input
63+
description: 'Who to greet'
64+
required: true
65+
default: 'World'
66+
outputs:
67+
random-number:
68+
description: "Random number"
69+
value: ${{ steps.random-number-generator.outputs.random-id }}
70+
runs:
71+
using: "composite"
72+
steps:
73+
- run: echo Hello ${{ inputs.who-to-greet }}.
74+
shell: bash
75+
- id: random-number-generator
76+
run: echo "::set-output name=random-id::$(echo $RANDOM)"
77+
shell: bash
78+
- run: ${{ github.action_path }}/goodbye.sh
79+
shell: bash
7680
```
7781
{% endraw %}
78-
このファイルは、入力</code> に誰が挨拶 `を定義し、ランダムに生成された数値を <code>乱数` 出力変数にマップし、 `goodbye.sh` スクリプトを実行します。 また、複合実行ステップアクションの実行方法をランナーに指示します。
79-
80-
出力の管理の詳細については、「複合実行手順の出力</code> を[`する」</a>参照してください。 </p>
82+
This file defines the `who-to-greet` input, maps the random generated number to the `random-number` output variable, and runs the `goodbye.sh` script. It also tells the runner how to execute the composite run steps action.
8183

82-
<p spaces-before="2"><code>github.action_path`の使用方法の詳細については、「github コンテキスト</code>](/actions/creating-actions/metadata-syntax-for-github-actions#outputs-for-composite-run-steps-actions)の
83-
84-
`」を参照してください。</p></li>
85-
<li><p spaces-before="0">ターミナルから、<code>action.yml` ファイルをチェックインします。
84+
For more information about managing outputs, see "[`outputs` for a composite run steps](/actions/creating-actions/metadata-syntax-for-github-actions#outputs-for-composite-run-steps-actions)".
8685

86+
For more information about how to use `github.action_path`, see "[`github context`](/actions/reference/context-and-expression-syntax-for-github-actions#github-context)".
8787

88+
1. From your terminal, check in your `action.yml` file.
8889

8990
```shell
9091
git add action.yml
9192
git commit -m "Add action"
9293
git push
9394
```
94-
</p></li>
9595

96-
1 ターミナルから、タグを追加します。 この例では、`v1` というタグを使用しています。 詳しい情報については、「[アクションについて](/actions/creating-actions/about-actions#using-release-management-for-actions)」を参照してください。
97-
98-
96+
1. From your terminal, add a tag. This example uses a tag called `v1`. For more information, see "[About actions](/actions/creating-actions/about-actions#using-release-management-for-actions)."
9997

10098
```shell
10199
git tag -a -m "Description of this release" v1
102100
git push --follow-tags
103101
```
104-
</ol>
105-
106102

103+
### Testing out your action in a workflow
107104

108-
### ワークフローでアクションを試す
105+
The following workflow code uses the completed hello world action that you made in "[Creating an action metadata file](/actions/creating-actions/creating-a-composite-run-steps-action#creating-an-action-metadata-file)".
109106

110-
次のワークフロー コードでは、「アクション メタデータ ファイルの作成」で行った完了した hello world アクション[使用](/actions/creating-actions/creating-a-composite-run-steps-action#creating-an-action-metadata-file)。
111-
112-
ワークフローコードを別のリポジトリの `.github/workflows/main.yml` ファイルにコピーしますが、`actions/hello-world-composite-run-steps-action@v1` は作成したリポジトリとタグに置き換えます。 `who-to-greet` 入力を自分の名前に置き換えることもできます。
107+
Copy the workflow code into a `.github/workflows/main.yml` file in another repository, but replace `actions/hello-world-composite-run-steps-action@v1` with the repository and tag you created. You can also replace the `who-to-greet` input with your name.
113108

114109
{% raw %}
115-
116-
**.github/ワークフロー/メイン.yml**
117-
118-
110+
**.github/workflows/main.yml**
119111
```yaml
120112
on: [push]
121113
122-
ジョブ:
114+
jobs:
123115
hello_world_job:
124-
実行: ubuntu-latest
125-
名: こんにちは
126-
ステップを言うジョブ:
127-
- 使用: アクション/checkout@v2
116+
runs-on: ubuntu-latest
117+
name: A job to say hello
118+
steps:
119+
- uses: actions/checkout@v2
128120
- id: foo
129-
使用: アクション/ハローワールドコンポジットランステップaction@v1
130-
:
131-
誰が挨拶: 'モナ・ザ・オクトキャット'
132-
- 実行: エコー乱数 ${{ steps.foo.outputs.random-number }}
133-
シェル:
121+
uses: actions/hello-world-composite-run-steps-action@v1
122+
with:
123+
who-to-greet: 'Mona the Octocat'
124+
- run: echo random-number ${{ steps.foo.outputs.random-number }}
125+
shell: bash
134126
```
135-
136-
137127
{% endraw %}
138128

139-
リポジトリから [**Actions**] タブをクリックして、最新のワークフロー実行を選択します。 出力には、「こんにちはモナオクトキャット」、"Goodbye"スクリプトの結果、および乱数が含まれている必要があります。
129+
From your repository, click the **Actions** tab, and select the latest workflow run. The output should include: "Hello Mona the Octocat", the result of the "Goodbye" script, and a random number.

0 commit comments

Comments
 (0)