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
Use this template to bootstrap the creation of a JavaScript action.:rocket:
3
+
Github Actions have [native support](https://github.blog/changelog/2021-02-08-github-actions-skip-pull-request-and-push-workflows-with-skip-ci/) to skip an entire workflow depending on commit message. But since we rely on status checks
4
+
for our Pull Requests to be green, we need another option.
4
5
5
-
This template includes compilication support, tests, a validation workflow, publishing, and versioning guidance.
6
+
This action accepts an input string `skipOnCommitMsg` which will be used to check if the commit message contains the given string.
7
+
If yes the output `shouldExecute` will be set to `false`. `true` otherwise. For full input / output list and other configurations check [`action.yml`](./action.yml).
6
8
7
-
If you are new, there's also a simpler introduction. See the [Hello World JavaScript Action](https://github.com/actions/hello-world-javascript-action)
9
+
## Example GitHub Workflow definition
10
+
This example shows how to setup two dependant jobs, the second will only be executed if the output from `checkExecution` job is `false`.
8
11
9
-
## Create an action from this template
10
-
11
-
Click the `Use this Template` and provide the new repo details for your action
12
-
13
-
## Code in Master
14
-
15
-
Install the dependencies
16
-
```bash
17
-
$ npm install
18
-
```
19
-
20
-
Build the typescript
21
-
```bash
22
-
$ npm run build
23
-
```
24
-
25
-
Run the tests :heavy_check_mark:
26
-
```bash
27
-
$ npm test
28
-
29
-
PASS ./index.test.js
30
-
✓ throws invalid number (3ms)
31
-
✓ wait 500 ms (504ms)
32
-
✓ test runs (95ms)
33
-
34
-
...
35
-
```
36
-
37
-
## Change action.yml
38
-
39
-
The action.yml contains defines the inputs and output for your action.
40
-
41
-
Update the action.yml with your name, description, inputs and outputs for your action.
42
-
43
-
See the [documentation](https://help.github.com/en/articles/metadata-syntax-for-github-actions)
44
-
45
-
## Change the Code
46
-
47
-
Most toolkit and CI/CD operations involve async operations so the action is run in an async function.
See the [toolkit documentation](https://github.com/actions/toolkit/blob/master/README.md#packages) for the various packages.
66
F438
code>
-
67
30
## Publish to a distribution branch
68
31
69
-
Actions are run from GitHub repos. We will create a releases branch and only checkin production modules (core in this case).
32
+
Actions will be consumed from GitHub repos. All the dependencies must be pushed there. This means for JS also
33
+
`node_module` must be published.
70
34
71
-
Comment out node_modulesin .gitignore and create a releases/v1 branch
35
+
Comment out `node_modules` in [.gitignore](./.gitignore) and create a `releases/**` branch
72
36
```bash
73
37
# comment out in distribution branches
74
38
# node_modules/
75
39
```
76
40
77
-
```bash
78
-
$ git checkout -b releases/v1
79
-
$ git commit -a -m "prod dependencies"
80
-
```
41
+
Then run the following commands:
81
42
82
43
```bash
44
+
$ git checkout -b releases/v1
83
45
$ npm prune --production
84
46
$ git add node_modules
85
47
$ git commit -a -m "prod dependencies"
@@ -90,24 +52,13 @@ Your action is now published! :rocket:
90
52
91
53
See the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
92
54
93
-
## Validate
94
-
95
-
You can now validate the action by referencing the releases/v1 branch
96
-
97
-
```yaml
98
-
uses: actions/typescript-action@releases/v1
99
-
with:
100
-
milliseconds: 1000
101
-
```
102
-
103
-
See the [actions tab](https://github.com/actions/javascript-action/actions) for runs of this action! :rocket:
104
-
105
55
## Usage:
106
56
107
57
After testing you can [create a v1 tag](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md) to reference the stable and tested action
core.debug(`reading git commit message to resolve the output variable, output variable will be true if commit message contains message "${skipOnCommitMsg}"`)
0 commit comments