From ba82e076a2acde86a358bfc31fd4d9d5d7bb5d60 Mon Sep 17 00:00:00 2001 From: Gregor Date: Mon, 4 Mar 2019 17:31:31 -0800 Subject: [PATCH] ci: test on pull requests from forks --- .github/main.workflow | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/.github/main.workflow b/.github/main.workflow index ad8c5669..97870480 100644 --- a/.github/main.workflow +++ b/.github/main.workflow @@ -19,19 +19,42 @@ action "Preview" { secrets = ["GITHUB_TOKEN"] } -workflow "Test" { +workflow "Test on push" { on = "push" - resolves = ["npm test"] + resolves = ["npm test (push)"] } -action "npm ci" { +action "npm ci (push)" { uses = "docker://node:alpine" runs = "npm" args = "ci" } -action "npm test" { - needs = "npm ci" +action "npm test (push)" { + needs = "npm ci (push)" + uses = "docker://node:alpine" + runs = "npm" + args = "test" +} + +workflow "Test on pull_request" { + on = "pull_request" + resolves = ["npm test (pull request)"] +} + +action "checkout pull request" { + uses = "gr2m/git-checkout-pull-request-action@master" +} + +action "npm ci (pull request)" { + needs = "checkout pull request" + uses = "docker://node:alpine" + runs = "npm" + args = "ci" +} + +action "npm test (pull request)" { + needs = "npm ci (pull request)" uses = "docker://node:alpine" runs = "npm" args = "test" @@ -43,7 +66,7 @@ workflow "Release" { } action "filter: master branch" { - needs = "npm test" + needs = "npm test (push)" uses = "actions/bin/filter@master" args = "branch master" }