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
If you want variable substitution, then either use the _shell_ form or execute a shell directly. For example, using the following _exec_ format, you can execute a shell to print the value stored in the `GITHUB_SHA` environment variable.
55
-
56
+
56
57
```
57
58
ENTRYPOINT ["sh", "-c", "echo $GITHUB_SHA"]
58
59
````
59
60
60
61
To supply `args` defined in the action's metadata file to a Docker container that uses the _exec_ form in the `ENTRYPOINT`, we recommend creating a shell script called `entrypoint.sh` that you call from the `ENTRYPOINT` instruction:
61
62
62
63
##### Example *Dockerfile*
63
-
```
64
+
```
64
65
# Container image that runs your code
65
66
FROM debian:9.5-slim
66
67
67
68
# Copies your code file from your action repository to the filesystem path `/` of the container
68
69
COPY entrypoint.sh /entrypoint.sh
69
70
70
-
# Executes `entrypoint.sh` when the Docker container starts up
71
+
# Executes `entrypoint.sh` when the Docker container starts up
71
72
ENTRYPOINT ["/entrypoint.sh"]
72
73
```
73
74
74
75
##### Example *entrypoint.sh* file
75
76
76
-
Using the example Dockerfile above, {% data variables.product.product_name %} will send the `args` configured in the action's metadata file as arguments to `entrypoint.sh`. Add the `#!/bin/sh` [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) at the top of the `entrypoint.sh` file to explicitly use the system's [POSIX](https://en.wikipedia.org/wiki/POSIX)-compliant shell.
77
+
Using the example Dockerfile above, {% data variables.product.product_name %} will send the `args` configured in the action's metadata file as arguments to `entrypoint.sh`. Add the `#!/bin/sh` [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) at the top of the `entrypoint.sh` file to explicitly use the system's [POSIX](https://en.wikipedia.org/wiki/POSIX)-compliant shell.
77
78
78
79
``` sh
79
80
#!/bin/sh
80
81
81
-
# `$*` expands the `args` supplied in an `array` individually
82
+
# `$*` expands the `args` supplied in an `array` individually
82
83
# or splits `args` in a string separated by whitespace.
83
84
sh -c "echo $*"
84
85
```
85
86
86
-
Your code must be executable. Make sure the `entrypoint.sh` file has `execute` permissions before using it in a workflow. You can modify the permission from your terminal using this command:
87
+
Your code must be executable. Make sure the `entrypoint.sh` file has `execute` permissions before using it in a workflow. You can modify the permission from your terminal using this command:
87
88
```sh
88
-
chmod +x entrypoint.sh
89
+
chmod +x entrypoint.sh
89
90
```
90
91
91
92
When an `ENTRYPOINT` shell script is not executable, you'll receive an error similar to this:
**Optional** Allows you to define conditions for the `pre:` action execution. The `pre:` action will only run if the conditions in `pre-if` are met. If not set, then `pre-if` defaults to `always()`.
162
-
Note that the `step` context is unavailable, as no steps have run yet.
163
+
Note that the `step` context is unavailable, as no steps have run yet.
163
164
164
165
In this example, `cleanup.js` only runs on Linux-based runners:
165
166
@@ -214,7 +215,7 @@ For example, this `cleanup.js` will only run on Linux-based runners:
214
215
```yaml
215
216
runs:
216
217
using: "composite"
217
-
steps:
218
+
steps:
218
219
- run: ${{ github.action_path }}/test/script.sh
219
220
shell: bash
220
221
```
@@ -225,7 +226,7 @@ Alternatively, you can use `$GITHUB_ACTION_PATH`:
225
226
```yaml
226
227
runs:
227
228
using: "composite"
228
-
steps:
229
+
steps:
229
230
- run: $GITHUB_ACTION_PATH/script.sh
230
231
shell: bash
231
232
```
@@ -254,20 +255,20 @@ For more information, see "[`github context`](/actions/reference/context-and-exp
254
255
255
256
### `runs` for Docker actions
256
257
257
-
**Required** Configures the image used for the Docker action.
258
+
**Required** Configures the image used for the Docker action.
258
259
259
260
#### Example using a Dockerfile in your repository
260
261
261
262
```yaml
262
-
runs:
263
+
runs:
263
264
using: 'docker'
264
265
image: 'Dockerfile'
265
266
```
266
267
267
268
#### Example using public Docker registry container
0 commit comments