From 6a15f7a6eda82d80dbb8ce43201a0e605287bc95 Mon Sep 17 00:00:00 2001 From: James Ives Date: Sun, 3 Mar 2019 17:04:48 -0500 Subject: [PATCH] Adds the filter example --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index bf0cd95f..16460bb0 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,31 @@ action "Deploy to GitHub Pages" { } ``` +If you'd like to filter the action so it only triggers on a specific branch you can combine it with the filter action. You can find an example of this below. + +``` +workflow "Deploy to Github Pages" { + on = "push" + resolves = ["Deploy to gh-pages"] +} + +action "master branch only" { + uses = "actions/bin/filter@master" + args = "branch master" +} + +action "Deploy to gh-pages" { + uses = "JamesIves/github-pages-deploy-action@access" + env = { + BRANCH = "gh-pages" + BUILD_SCRIPT = "npm install && npm run-script build" + FOLDER = "build" + } + secrets = ["ACCESS_TOKEN"] + needs = ["master branch only"] +} +``` + ## Configuration 📁 The `secrets` and `env` portion of the workflow **must** be configured before the action will work. Below you'll find a description of what each one does.