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
* Add back changes from prior to purge
* Manually fix some invalid Liquid
* Updoot render-content
* Improve test messages to show correct output
* Run el scripto
* Pass the remaining test
Copy file name to clipboardExpand all lines: content/actions/creating-actions/about-actions.md
+21-21
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: About actions
3
-
intro: 'Actions are individual tasks that you can combine to create jobs and customize your workflow. You can create your own actions, or use and customize actions shared by the {{ site.data.variables.product.prodname_dotcom }} community.'
intro: 'Actions are individual tasks that you can combine to create jobs and customize your workflow. You can create your own actions, or use and customize actions shared by the {% datavariables.product.prodname_dotcom %} community.'
You can create actions by writing custom code that interacts with your repository in any way you'd like, including integrating with {{ site.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.
20
+
You can create actions by writing custom code that interacts with your repository in any way you'd like, including integrating with {% datavariables.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.
21
21
22
22
{% if currentVersion == "free-pro-team@latest" %}
23
-
You can write your own actions to use in your workflow or share the actions you build with the {{ site.data.variables.product.prodname_dotcom }} community. To share actions you've built, your repository must be public.
23
+
You can write your own actions to use in your workflow or share the actions you build with the {% datavariables.product.prodname_dotcom %} community. To share actions you've built, your repository must be public.
24
24
{% endif %}
25
25
26
26
Actions can run directly on a machine or in a Docker container. You can define an action's inputs, outputs, and environment variables.
27
27
28
28
### Types of actions
29
29
30
-
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 {{ site.data.variables.product.prodname_actions }}](/articles/metadata-syntax-for-github-actions)."
30
+
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 {% datavariables.product.prodname_actions %}](/articles/metadata-syntax-for-github-actions)."
31
31
32
32
| Type | Operating system |
33
33
| ---- | ------------------- |
@@ -37,19 +37,19 @@ You can build Docker container and JavaScript actions. Actions require a metadat
37
37
38
38
#### Docker container actions
39
39
40
-
Docker containers package the environment with the {{ site.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.
40
+
Docker containers package the environment with the {% datavariables.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.
41
41
42
42
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.
43
43
44
-
Docker container actions can only execute on runners with a Linux operating system. {{ site.data.reusables.github-actions.self-hosted-runner-reqs-docker }}
44
+
Docker container actions can only execute on runners with a Linux operating system. {% datareusables.github-actions.self-hosted-runner-reqs-docker %}
45
45
46
46
#### JavaScript actions
47
47
48
48
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.
If you're developing a Node.js project, the {{ site.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.
52
+
If you're developing a Node.js project, the {% datavariables.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.
53
53
54
54
#### Composite run steps actions
55
55
@@ -60,14 +60,14 @@ A _composite run steps_ action allows you to combine multiple workflow run steps
60
60
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.
61
61
62
62
{% if currentVersion == "free-pro-team@latest" %}
63
-
Storing an action in its own repository makes it easier for the {{ site.data.variables.product.prodname_dotcom }} community to discover the action, narrows the scope of the code base for developers fixing issues and extending the action, and decouples the action's versioning from the versioning of other application code.
63
+
Storing an action in its own repository makes it easier for the {% datavariables.product.prodname_dotcom %} community to discover the action, narrows the scope of the code base for developers fixing issues and extending the action, and decouples the action's versioning from the versioning of other application code.
64
64
{% endif %}
65
65
66
66
{% 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`.
67
67
68
-
### Compatibility with {{ site.data.variables.product.prodname_ghe_server }}
68
+
### Compatibility with {% datavariables.product.prodname_ghe_server %}
69
69
70
-
To ensure that your action is compatible with {{ site.data.variables.product.prodname_ghe_server }}, you should make sure that you do not use any hard-coded references to {{ site.data.variables.product.prodname_dotcom }} API URLs. You should instead use environment variables to refer to the {{ site.data.variables.product.prodname_dotcom }} API:
70
+
To ensure that your action is compatible with {% datavariables.product.prodname_ghe_server %}, you should make sure that you do not use any hard-coded references to {% datavariables.product.prodname_dotcom %} API URLs. You should instead use environment variables to refer to the {% datavariables.product.prodname_dotcom %} API:
71
71
72
72
- For the REST API, use the `GITHUB_API_URL` environment variable.
73
73
- For GraphQL, use the `GITHUB_GRAPHQL_URL` environment variable.
@@ -84,7 +84,7 @@ If you're developing an action for other people to use, we recommend using relea
84
84
85
85
Under this release management approach, users should not be referencing an action's `master` 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.
86
86
87
-
To use a specific action version, users can configure their {{ site.data.variables.product.prodname_actions }} workflow to target a tag, a commit's SHA, or a branch named for a release.
87
+
To use a specific action version, users can configure their {% datavariables.product.prodname_actions %} workflow to target a tag, a commit's SHA, or a branch named for a release.
88
88
89
89
#### Using tags for release management
90
90
@@ -139,21 +139,21 @@ We recommend creating a README file to help people learn how to use your action.
139
139
- Environment variables the action uses
140
140
- An example of how to use your action in a workflow
141
141
142
-
### Comparing {{ site.data.variables.product.prodname_actions }} to {{ site.data.variables.product.prodname_github_apps}}
142
+
### Comparing {% datavariables.product.prodname_actions %} to {% datavariables.product.prodname_github_apps %}
143
143
144
-
{{ site.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/)."
144
+
{% datavariables.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/)."
145
145
146
146
#### Strengths of GitHub Actions and GitHub Apps
147
147
148
-
While both {{ site.data.variables.product.prodname_actions }} and {{ site.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.
148
+
While both {% datavariables.product.prodname_actions %} and {% datavariables.product.prodname_github_app %}s provide ways to build automation and workflow tools, they each have strengths that make them useful in different ways.
* Provide automation that can perform continuous integration and continuous deployment.
158
158
* Can run directly on runner machines or in Docker containers.
159
159
* Can include access to a clone of your repository, enabling deployment and publishing tools, code formatters, and command line tools to access your code.
@@ -162,4 +162,4 @@ While both {{ site.data.variables.product.prodname_actions }} and {{ site.data.v
162
162
163
163
### Further reading
164
164
165
-
- "[Development tools for {{ site.data.variables.product.prodname_actions }}](/articles/development-tools-for-github-actions)"
165
+
- "[Development tools for {% datavariables.product.prodname_actions %}](/articles/development-tools-for-github-actions)"
@@ -18,9 +18,9 @@ Once you complete this project, you should understand how to build your own comp
18
18
19
19
### Prerequisites
20
20
21
-
Before you begin, you'll create a {{ site.data.variables.product.product_name }} repository.
21
+
Before you begin, you'll create a {% datavariables.product.product_name %} repository.
22
22
23
-
1. Create a new public repository on {{ site.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 {{ site.data.variables.product.product_name }}. For more information, see "[Create a new repository](/articles/creating-a-new-repository)."
23
+
1. Create a new public repository on {% datavariables.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 {% datavariables.product.product_name %}. For more information, see "[Create a new repository](/articles/creating-a-new-repository)."
24
24
25
25
1. Clone your repository to your computer. For more information, see "[Cloning a repository](/articles/cloning-a-repository)."
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.
21
21
22
22
Once you complete this project, you should understand how to build your own Docker container action and test it in a workflow.
You may find it helpful to have a basic understanding of {{ site.data.variables.product.prodname_actions }} environment variables and the Docker container filesystem:
28
+
You may find it helpful to have a basic understanding of {% datavariables.product.prodname_actions %} environment variables and the Docker container filesystem:
- "[Virtual environments for {{ site.data.variables.product.prodname_dotcom }}](/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners#docker-container-filesystem)"
31
+
- "[Virtual environments for {% datavariables.product.prodname_dotcom %}](/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners#docker-container-filesystem)"
32
32
33
33
Before you begin, you'll need to create a GitHub repository.
34
34
35
-
1. Create a new repository on {{ site.data.variables.product.product_location }}. You can choose any repository name or use "hello-world-docker-action" like this example. For more information, see "[Create a new repository](/articles/creating-a-new-repository)."
35
+
1. Create a new repository on {% datavariables.product.product_location %}. You can choose any repository name or use "hello-world-docker-action" like this example. For more information, see "[Create a new repository](/articles/creating-a-new-repository)."
36
36
37
37
1. Clone your repository to your computer. For more information, see "[Cloning a repository](/articles/cloning-a-repository)."
38
38
@@ -44,7 +44,7 @@ Before you begin, you'll need to create a GitHub repository.
44
44
45
45
### Creating a Dockerfile
46
46
47
-
In your new `hello-world-docker-action` directory, create a new `Dockerfile` file. For more information, see "[Dockerfile support for {{ site.data.variables.product.prodname_actions }}](/actions/creating-actions/dockerfile-support-for-github-actions)."
47
+
In your new `hello-world-docker-action` directory, create a new `Dockerfile` file. For more information, see "[Dockerfile support for {% datavariables.product.prodname_actions %}](/actions/creating-actions/dockerfile-support-for-github-actions)."
48
48
49
49
**Dockerfile**
50
50
```dockerfile
@@ -60,7 +60,7 @@ ENTRYPOINT ["/entrypoint.sh"]
60
60
61
61
### Creating an action metadata file
62
62
63
-
Create a new `action.yml` file in the `hello-world-docker-action` directory you created above. For more information, see "[Metadata syntax for {{ site.data.variables.product.prodname_actions }}](/actions/creating-actions/metadata-syntax-for-github-actions)."
63
+
Create a new `action.yml` file in the `hello-world-docker-action` directory you created above. For more information, see "[Metadata syntax for {% datavariables.product.prodname_actions %}](/actions/creating-actions/metadata-syntax-for-github-actions)."
64
64
65
65
{% raw %}
66
66
**action.yml**
@@ -86,13 +86,13 @@ runs:
86
86
87
87
This metadata defines one `who-to-greet` input and one `time` output parameter. To pass inputs to the Docker container, you must declare the input using `inputs` and pass the input in the `args` keyword.
88
88
89
-
{{ site.data.variables.product.prodname_dotcom }} will build an image from your `Dockerfile`, and run commands in a new container using this image.
89
+
{% datavariables.product.prodname_dotcom %} will build an image from your `Dockerfile`, and run commands in a new container using this image.
90
90
91
91
### Writing the action code
92
92
93
93
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.
94
94
95
-
Next, the script gets the current time and sets it as an output variable that actions running later in a job can use. In order for {{ site.data.variables.product.prodname_dotcom }} to recognize output variables, you must use a workflow command in a specific syntax: `echo "::set-output name=<output name>::<value>"`. For more information, see "[Workflow commands for {{ site.data.variables.product.prodname_actions }}](/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter)."
95
+
Next, the script gets the current time and sets it as an output variable that actions running later in a job can use. In order for {% datavariables.product.prodname_dotcom %} to recognize output variables, you must use a workflow command in a specific syntax: `echo "::set-output name=<output name>::<value>"`. For more information, see "[Workflow commands for {% datavariables.product.prodname_actions %}](/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter)."
96
96
97
97
1. Create a new `entrypoint.sh` file in the `hello-world-docker-action` directory.
98
98
@@ -153,7 +153,7 @@ with:
153
153
who-to-greet: 'Mona the Octocat'
154
154
```
155
155
156
-
### Commit, tag, and push your action to {{ site.data.variables.product.product_name }}
156
+
### Commit, tag, and push your action to {% datavariables.product.product_name %}
157
157
158
158
From your terminal, commit your `action.yml`, `entrypoint.sh`, `Dockerfile`, and `README.md` files.
159
159
@@ -170,7 +170,7 @@ git push --follow-tags
170
170
171
171
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.
0 commit comments