|
| 1 | +# Action Debugger |
1 | 2 |
|
2 |
| -<p align="center"> |
3 |
| - <a href="https://github.com/actions/javascript-action"><img alt="GitHub Actions status" src="https://github.com/actions/javascript-action/workflows/test-local/badge.svg"></a> |
4 |
| -</p> |
| 3 | +Interactive debugger for GitHub Actions |
5 | 4 |
|
6 |
| -# Create a JavaScript Action |
| 5 | +## Acknowledgments |
7 | 6 |
|
8 |
| -Use this template to bootstrap the creation of a JavaScript action.:rocket: |
| 7 | +* [tmate.io](https://tmate.io) |
| 8 | +* Max Schmitt's [action-tmate](https://github.com/mxschmitt/action-tmate) |
9 | 9 |
|
10 |
| -This template includes tests, linting, a validation workflow, publishing, and versioning guidance. |
| 10 | +### License |
11 | 11 |
|
12 |
| -If you are new, there's also a simpler introduction. See the [Hello World JavaScript Action](https://github.com/actions/hello-world-javascript-action) |
13 |
| - |
14 |
| -## Create an action from this template |
15 |
| - |
16 |
| -Click the `Use this Template` and provide the new repo details for your action |
17 |
| - |
18 |
| -## Code in Master |
19 |
| - |
20 |
| -Install the dependencies |
21 |
| -```bash |
22 |
| -$ npm install |
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. |
48 |
| - |
49 |
| -```javascript |
50 |
| -const core = require('@actions/core'); |
51 |
| -... |
52 |
| - |
53 |
| -async function run() { |
54 |
| - try { |
55 |
| - ... |
56 |
| - } |
57 |
| - catch (error) { |
58 |
| - core.setFailed(error.message); |
59 |
| - } |
60 |
| -} |
61 |
| - |
62 |
| -run() |
63 |
| -``` |
64 |
| - |
65 |
| -See the [toolkit documentation](https://github.com/actions/toolkit/blob/master/README.md#packages) for the various packages. |
66 |
| - |
67 |
| -## Publish to a distribution branch |
68 |
| - |
69 |
| -Actions are run from GitHub repos. We will create a releases branch and only checkin production modules (core in this case). |
70 |
| - |
71 |
| -Comment out node_modules in .gitignore and create a releases/v1 branch |
72 |
| -```bash |
73 |
| -# comment this out distribution branches |
74 |
| -# node_modules/ |
75 |
| -``` |
76 |
| - |
77 |
| -```bash |
78 |
| -$ git checkout -b releases/v1 |
79 |
| -$ git commit -a -m "prod dependencies" |
80 |
| -``` |
81 |
| - |
82 |
| -```bash |
83 |
| -$ npm prune --production |
84 |
| -$ git add node_modules |
85 |
| -$ git commit -a -m "prod dependencies" |
86 |
| -$ git push origin releases/v1 |
87 |
| -``` |
88 |
| - |
89 |
| -Your action is now published! :rocket: |
90 |
| - |
91 |
| -See the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md) |
92 |
| - |
93 |
| -## Validate |
94 |
| - |
95 |
| -You can now validate the action by referencing the releases/v1 branch |
96 |
| - |
97 |
| -```yaml |
98 |
| -uses: actions/javascript-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 |
| -## Usage: |
106 |
| -
|
107 |
| -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 |
108 |
| -
|
109 |
| -```yaml |
110 |
| -uses: actions/javascript-action@v1 |
111 |
| -with: |
112 |
| - milliseconds: 1000 |
113 |
| -``` |
| 12 | +The action and associated scripts and documentation in this project are released under the MIT License. |
0 commit comments