From 1643ea2734516db5d2fe78423234cd638d5bdbb8 Mon Sep 17 00:00:00 2001 From: Bryan MacFarlane Date: Thu, 3 Oct 2019 12:45:11 -0400 Subject: [PATCH] update readme --- .../{workflow.yml => unit-tests.yml} | 6 +- README.md | 55 +++++++++++++------ 2 files changed, 43 insertions(+), 18 deletions(-) rename .github/workflows/{workflow.yml => unit-tests.yml} (96%) diff --git a/.github/workflows/workflow.yml b/.github/workflows/unit-tests.yml similarity index 96% rename from .github/workflows/workflow.yml rename to .github/workflows/unit-tests.yml index e13e5676..9890a5d3 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/unit-tests.yml @@ -1,5 +1,9 @@ name: toolkit-unit-tests -on: [push] +on: + push: + paths: + - 'packages/**' + - '*.json' jobs: Ubuntu: name: Run Ubuntu diff --git a/README.md b/README.md index 628224c1..7fe339d2 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,15 @@ GitHub Actions status

+ ## GitHub Actions Toolkit The GitHub Actions ToolKit provides a set of packages to make creating actions easier. +
+

Get started with the javascript-action template!

+
+ ## Packages :heavy_check_mark: [@actions/core](packages/core) @@ -66,6 +71,12 @@ Outlines the differences and why you would want to create a JavaScript or a cont

+:curly_loop: [Versioning](docs/action-versioning.md) + +Actions are downloaded and run from the GitHub graph of repos. This contains guidance for versioning actions and safe releases. +
+
+ [Hello World JavaScript Action](https://github.com/actions/hello-world-javascript-action) Illustrates how to create a simple hello world javascript action. @@ -83,7 +94,14 @@ Illustrates how to create a simple hello world javascript action. Walkthrough and template for creating a JavaScript Action with tests, linting, workflow, publishing, and versioning. - ```javascript +```javascript +async function run() { + try { + const ms = core.getInput('milliseconds'); + console.log(`Waiting ${ms} milliseconds ...`) + ... +``` +```javascript PASS ./index.test.js ✓ throws invalid number ✓ wait 500 ms @@ -91,7 +109,7 @@ PASS ./index.test.js Test Suites: 1 passed, 1 total Tests: 3 passed, 3 total - ``` +```

@@ -107,13 +125,15 @@ async function run() { const ms = core.getInput('milliseconds'); console.log(`Waiting ${ms} milliseconds ...`) ... +``` +```javascript +PASS ./index.test.js + ✓ throws invalid number + ✓ wait 500 ms + ✓ test runs - } catch (error) { - core.setFailed(error.message); - } -} - -run(); +Test Suites: 1 passed, 1 total +Tests: 3 passed, 3 total ```

@@ -124,11 +144,8 @@ Create an action that is delivered as a container and run with docker. ```docker FROM alpine:3.10 - COPY LICENSE README.md / - COPY entrypoint.sh /entrypoint.sh - ENTRYPOINT ["/entrypoint.sh"] ```
@@ -138,18 +155,22 @@ ENTRYPOINT ["/entrypoint.sh"] Create an action that is delivered as a container which uses the toolkit. This example uses the GitHub context to construct an Octokit client. +```docker +FROM node:slim +COPY . . +RUN npm install --production +ENTRYPOINT ["node", "/lib/main.js"] +``` ```javascript - const myInput = core.getInput('myInput'); - core.debug(`Hello ${myInput} from inside a container`); +const myInput = core.getInput('myInput'); +core.debug(`Hello ${myInput} from inside a container`); - const context = github.context; - console.log(`We can even get context data, like the repo: ${context.repo.repo}`) +const context = github.context; +console.log(`We can even get context data, like the repo: ${context.repo.repo}`) ```

-:curly_loop: [Versioning](docs/action-versioning.md) - Recommendations on versioning, releases and tagging your action.