You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/actions/creating-actions/about-actions.md
+16-16Lines changed: 16 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ topics:
21
21
{% data reusables.actions.enterprise-github-hosted-runners %}
22
22
{% data reusables.actions.ae-beta %}
23
23
24
-
###About actions
24
+
## About actions
25
25
26
26
You can create actions by writing custom code that interacts with your repository in any way you'd like, including integrating with {% data variables.product.prodname_dotcom %}'s APIs and any publicly available third-party API. For example, an action can publish npm modules, send SMS alerts when urgent issues are created, or deploy production-ready code.
27
27
@@ -31,7 +31,7 @@ You can write your own actions to use in your workflow or share the actions you
31
31
32
32
Actions can run directly on a machine or in a Docker container. You can define an action's inputs, outputs, and environment variables.
33
33
34
-
###Types of actions
34
+
## Types of actions
35
35
36
36
You can build Docker container and JavaScript actions. Actions require a metadata file to define the inputs, outputs and main entrypoint for your action. The metadata filename must be either `action.yml` or `action.yaml`. For more information, see "[Metadata syntax for {% data variables.product.prodname_actions %}](/articles/metadata-syntax-for-github-actions)."
37
37
@@ -41,27 +41,27 @@ You can build Docker container and JavaScript actions. Actions require a metadat
41
41
| JavaScript | Linux, macOS, Windows |
42
42
| Composite run steps | Linux, macOS, Windows |
43
43
44
-
####Docker container actions
44
+
### Docker container actions
45
45
46
46
Docker containers package the environment with the {% data variables.product.prodname_actions %} code. This creates a more consistent and reliable unit of work because the consumer of the action does not need to worry about the tools or dependencies.
47
47
48
48
A Docker container allows you to use specific versions of an operating system, dependencies, tools, and code. For actions that must run in a specific environment configuration, Docker is an ideal option because you can customize the operating system and tools. Because of the latency to build and retrieve the container, Docker container actions are slower than JavaScript actions.
49
49
50
50
Docker container actions can only execute on runners with a Linux operating system. {% data reusables.github-actions.self-hosted-runner-reqs-docker %}
51
51
52
-
####JavaScript actions
52
+
### JavaScript actions
53
53
54
54
JavaScript actions can run directly on a runner machine, and separate the action code from the environment used to run the code. Using a JavaScript action simplifies the action code and executes faster than a Docker container action.
55
55
56
56
{% data reusables.github-actions.pure-javascript %}
57
57
58
58
If you're developing a Node.js project, the {% data variables.product.prodname_actions %} Toolkit provides packages that you can use in your project to speed up development. For more information, see the [actions/toolkit](https://github.com/actions/toolkit) repository.
59
59
60
-
####Composite run steps actions
60
+
### Composite run steps actions
61
61
62
62
A _composite run steps_ action allows you to combine multiple workflow run steps within one action. For example, you can use this feature to bundle together multiple run commands into an action, and then have a workflow that executes the bundled commands a single step using that action. To see an example, check out "[Creating a composite run steps action](/actions/creating-actions/creating-a-composite-run-steps-action)".
63
63
64
-
###Choosing a location for your action
64
+
## Choosing a location for your action
65
65
66
66
If you're developing an action for other people to use, we recommend keeping the action in its own repository instead of bundling it with other application code. This allows you to version, track, and release the action just like any other software.
67
67
@@ -71,7 +71,7 @@ Storing an action in its own repository makes it easier for the {% data variable
71
71
72
72
{% if currentVersion == "free-pro-team@latest" %}If you're building an action that you don't plan to make available to the public, you {% else %} You{% endif %} can store the action's files in any location in your repository. If you plan to combine action, workflow, and application code in a single repository, we recommend storing actions in the `.github` directory. For example, `.github/actions/action-a` and `.github/actions/action-b`.
73
73
74
-
###Compatibility with {% data variables.product.prodname_ghe_server %}
74
+
## Compatibility with {% data variables.product.prodname_ghe_server %}
75
75
76
76
To ensure that your action is compatible with {% data variables.product.prodname_ghe_server %}, you should make sure that you do not use any hard-coded references to {% data variables.product.prodname_dotcom %} API URLs. You should instead use environment variables to refer to the {% data variables.product.prodname_dotcom %} API:
77
77
@@ -80,19 +80,19 @@ To ensure that your action is compatible with {% data variables.product.prodname
80
80
81
81
For more information, see "[Default environment variables](/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables)."
82
82
83
-
###Using release management for actions
83
+
## Using release management for actions
84
84
85
85
This section explains how you can use release management to distribute updates to your actions in a predictable way.
86
86
87
-
####Good practices for release management
87
+
### Good practices for release management
88
88
89
89
If you're developing an action for other people to use, we recommend using release management to control how you distribute updates. Users can expect an action's major version to include necessary critical fixes and security patches, while still remaining compatible with their existing workflows. You should consider releasing a new major version whenever your changes affect compatibility.
90
90
91
91
Under this release management approach, users should not be referencing an action's default branch, as it's likely to contain the latest code and consequently might be unstable. Instead, you can recommend that your users specify a major version when using your action, and only direct them to a more specific version if they encounter issues.
92
92
93
93
To use a specific action version, users can configure their {% data variables.product.prodname_actions %} workflow to target a tag, a commit's SHA, or a branch named for a release.
94
94
95
-
####Using tags for release management
95
+
### Using tags for release management
96
96
97
97
We recommend using tags for actions release management. Using this approach, your users can easily distinguish between major and minor versions:
If you prefer to use branch names for release management, this example demonstrates how to reference a named branch:
122
122
@@ -125,7 +125,7 @@ steps:
125
125
- uses: actions/javascript-action@v1-beta
126
126
```
127
127
128
-
#### Using a commit's SHA for release management
128
+
### Using a commit's SHA for release management
129
129
130
130
Each Git commit receives a calculated SHA value, which is unique and immutable. Your action's users might prefer to rely on a commit's SHA value, as this approach can be more reliable than specifying a tag, which could be deleted or moved. However, this means that users will not receive further updates made to the action. {% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "[email protected]" or currentVersion == "github-ae@latest" %}You must use a commit's full SHA value, and not an abbreviated value.{% else %}Using a commit's full SHA value instead of the abbreviated value can help prevent people from using a malicious commit that uses the same abbreviation.{% endif %}
We recommend creating a README file to help people learn how to use your action. You can include this information in your `README.md`:
140
140
@@ -145,11 +145,11 @@ We recommend creating a README file to help people learn how to use your action.
145
145
- Environment variables the action uses
146
146
- An example of how to use your action in a workflow
147
147
148
-
### Comparing {% data variables.product.prodname_actions %} to {% data variables.product.prodname_github_apps %}
148
+
## Comparing {% data variables.product.prodname_actions %} to {% data variables.product.prodname_github_apps %}
149
149
150
150
{% data variables.product.prodname_marketplace %} offers tools to improve your workflow. Understanding the differences and the benefits of each tool will allow you to select the best tool for your job. For more information about building apps, see "[About apps](/apps/about-apps/)."
151
151
152
-
#### Strengths of GitHub Actions and GitHub Apps
152
+
### Strengths of GitHub Actions and GitHub Apps
153
153
154
154
While both {% data variables.product.prodname_actions %} and {% data variables.product.prodname_github_app %}s provide ways to build automation and workflow tools, they each have strengths that make them useful in different ways.
155
155
@@ -166,6 +166,6 @@ While both {% data variables.product.prodname_actions %} and {% data variables.p
166
166
* Don't require you to deploy code or serve an app.
167
167
* Have a simple interface to create and use secrets, which enables actions to interact with third-party services without needing to store the credentials of the person using the action.
168
168
169
-
### Further reading
169
+
## Further reading
170
170
171
171
- "[Development tools for {% data variables.product.prodname_actions %}](/articles/development-tools-for-github-actions)"
Copy file name to clipboardExpand all lines: content/actions/creating-actions/creating-a-composite-run-steps-action.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -15,15 +15,15 @@ topics:
15
15
{% data reusables.actions.enterprise-github-hosted-runners %}
16
16
{% data reusables.actions.ae-beta %}
17
17
18
-
###Introduction
18
+
## Introduction
19
19
20
20
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`.
21
21
22
22
Once you complete this project, you should understand how to build your own composite run steps action and test it in a workflow.
23
23
24
24
{% data reusables.github-actions.context-injection-warning %}
25
25
26
-
###Prerequisites
26
+
## Prerequisites
27
27
28
28
Before you begin, you'll create a {% data variables.product.product_name %} repository.
29
29
@@ -56,7 +56,7 @@ Before you begin, you'll create a {% data variables.product.product_name %} repo
56
56
git push
57
57
```
58
58
59
-
###Creating an action metadata file
59
+
## Creating an action metadata file
60
60
61
61
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)".
62
62
@@ -107,7 +107,7 @@ Before you begin, you'll create a {% data variables.product.product_name %} repo
107
107
git push --follow-tags
108
108
```
109
109
110
-
### Testing out your action in a workflow
110
+
## Testing out your action in a workflow
111
111
112
112
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)".
Copy file name to clipboardExpand all lines: content/actions/creating-actions/creating-a-docker-container-action.md
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ topics:
21
21
{% data reusables.actions.enterprise-github-hosted-runners %}
22
22
{% data reusables.actions.ae-beta %}
23
23
24
-
###Introduction
24
+
## Introduction
25
25
26
26
In this guide, you'll learn about the basic components needed to create and use a packaged Docker container 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" in the logs or "Hello [who-to-greet]" if you provide a custom name.
27
27
@@ -31,7 +31,7 @@ Once you complete this project, you should understand how to build your own Dock
31
31
32
32
{% data reusables.github-actions.context-injection-warning %}
33
33
34
-
###Prerequisites
34
+
## Prerequisites
35
35
36
36
You may find it helpful to have a basic understanding of {% data variables.product.prodname_actions %} environment variables and the Docker container filesystem:
37
37
@@ -54,7 +54,7 @@ Before you begin, you'll need to create a {% data variables.product.prodname_dot
54
54
cd hello-world-docker-action
55
55
```
56
56
57
-
###Creating a Dockerfile
57
+
## Creating a Dockerfile
58
58
59
59
In your new `hello-world-docker-action` directory, create a new `Dockerfile` file. For more information, see "[Dockerfile support for {% data variables.product.prodname_actions %}](/actions/creating-actions/dockerfile-support-for-github-actions)."
Create a new `action.yml` file in the `hello-world-docker-action` directory you created above. For more information, see "[Metadata syntax for {% data variables.product.prodname_actions %}](/actions/creating-actions/metadata-syntax-for-github-actions)."
76
76
@@ -100,7 +100,7 @@ This metadata defines one `who-to-greet` input and one `time` output parameter.
100
100
101
101
{% data variables.product.prodname_dotcom %} will build an image from your `Dockerfile`, and run commands in a new container using this image.
102
102
103
-
###Writing the action code
103
+
## Writing the action code
104
104
105
105
You can choose any base Docker image and, therefore, any language for your action. The following shell script example uses the `who-to-greet` input variable to print "Hello [who-to-greet]" in the log file.
106
106
@@ -126,7 +126,7 @@ Next, the script gets the current time and sets it as an output variable that ac
126
126
$ chmod +x entrypoint.sh
127
127
```
128
128
129
-
###Creating a README
129
+
## Creating a README
130
130
131
131
To let people know how to use your action, you can create a README file. A README is most helpful when you plan to share your action publicly, but is also a great way to remind you or your team how to use the action.
132
132
@@ -147,13 +147,13 @@ This action prints "Hello World" or "Hello" + the name of a person to greet to t
147
147
148
148
## Inputs
149
149
150
-
### `who-to-greet`
150
+
## `who-to-greet`
151
151
152
152
**Required** The name of the person to greet. Default `"World"`.
153
153
154
154
## Outputs
155
155
156
-
### `time`
156
+
## `time`
157
157
158
158
The time we greeted you.
159
159
@@ -164,7 +164,7 @@ with:
164
164
who-to-greet: 'Mona the Octocat'
165
165
```
166
166
167
-
###Commit, tag, and push your action to {% data variables.product.product_name %}
167
+
## Commit, tag, and push your action to {% data variables.product.product_name %}
168
168
169
169
From your terminal, commit your `action.yml`, `entrypoint.sh`, `Dockerfile`, and `README.md` files.
170
170
@@ -177,13 +177,13 @@ git tag -a -m "My first action release" v1
177
177
git push --follow-tags
178
178
```
179
179
180
-
###Testing out your action in a workflow
180
+
## Testing out your action in a workflow
181
181
182
182
Now you're ready to test your action out in a workflow. When an action is in a private repository, the action can only be used in workflows in the same repository. Public actions can be used by workflows in any repository.
183
183
184
184
{% data reusables.actions.enterprise-marketplace-actions %}
185
185
186
-
####Example using a public action
186
+
### Example using a public action
187
187
188
188
The following workflow code uses the completed _hello world_ action in the public [`actions/hello-world-docker-action`](https://github.com/actions/hello-world-docker-action) repository. Copy the following workflow example code into a `.github/workflows/main.yml` file, but replace the `actions/hello-world-docker-action` with your repository and action name. You can also replace the `who-to-greet` input with your name. {% if currentVersion == "free-pro-team@latest" %}Public actions can be used even if they're not published to {% data variables.product.prodname_marketplace %}. For more information, see "[Publishing an action](/actions/creating-actions/publishing-actions-in-github-marketplace#publishing-an-action)." {% endif %}
189
189
@@ -208,7 +208,7 @@ jobs:
208
208
```
209
209
{% endraw %}
210
210
211
-
####Example using a private action
211
+
### Example using a private action
212
212
213
213
Copy the following example workflow code into a `.github/workflows/main.yml` file in your action's repository. You can also replace the `who-to-greet` input with your name. {% if currentVersion == "free-pro-team@latest" %}This private action can't be published to {% data variables.product.prodname_marketplace %}, and can only be used in this repository.{% endif %}
0 commit comments