From 5ce4932391d819ac86818818d7865130480c40f1 Mon Sep 17 00:00:00 2001 From: Tingluo Huang Date: Thu, 3 Oct 2019 00:41:30 -0400 Subject: [PATCH] update doc. --- packages/core/README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/packages/core/README.md b/packages/core/README.md index 58a8287f..46e405f2 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -94,4 +94,37 @@ const result = await core.group('Do something async', async () => { const response = await doSomeHTTPRequest() return response }) +``` + +#### Action state + +You can use this library to save state and get state for sharing information between a given wrapper action: + +**action.yml** +```yaml +name: 'Wrapper action sample' +inputs: + name: + default: 'GitHub' +runs: + using: 'node12' + main: 'main.js' + post: 'cleanup.js' +``` + +In action's `main.js`: + +```js +const core = require('@actions/core'); + +core.saveState("pidToKill", 12345); +``` + +In action's `cleanup.js`: +```js +const core = require('@actions/core'); + +var pid = core.getState("pidToKill"); + +kill(pid); ``` \ No newline at end of file