Skip to content
Branch: master
Find file History
piki Merge pull request #42 from c-bata/add-deleted_branch-filter
Add deleted_branch and deleted_tag filters
Latest commit d820d56 Mar 1, 2019
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
bin Fix tests and probably linter Feb 28, 2019
test Merge pull request #42 from c-bata/add-deleted_branch-filter Mar 1, 2019
Dockerfile
LICENSE
Makefile
README.md
THIRD_PARTY_NOTICE.md Initial commit Oct 16, 2018
entrypoint.sh

README.md

Filters for GitHub Actions

This action includes common filters to stop workflows unless certain conditions are met.

For example, here is a workflow that publishes a package to npm when the master branch receives a push:

workflow "Build, Test, and Publish" {
  on = "push"
  resolves = ["Publish"]
}

action "Build" {
  uses = "actions/npm@master"
  args = "install"
}

action "Test" {
  needs = "Build"
  uses = "actions/npm@master"
  args = "test"
}

# Filter for master branch
action "Master" {
  needs = "Test"
  uses = "actions/bin/filter@master"
  args = "branch master"
}

action "Publish" {
  needs = "Master"
  uses = "actions/npm@master"
  args = "publish --access public"
  secrets = ["NPM_AUTH_TOKEN"]
}

Available filters

tag

Continue if the event is a tag.

action "tag-filter" {
  uses = "actions/bin/filter@master"
  args = "tag"
}

Optionally supply a pattern of tags to match:

  args = "tag v*"

deleted_tag

Continue if the event deletes a tag.

action "tag-filter" {
  uses = "actions/bin/filter@master"
  args = "deleted_tag"
}

Optionally supply a pattern of tags to match:

  args = "deleted_tag v*"

branch

Continue if the event is a branch.

action "branch-filter" {
  uses = "actions/bin/filter@master"
  args = "branch"
}

Optionally supply a pattern of branches to match:

  args = "branch stable-*"

deleted_branch

Continue if the event deletes a branch.

action "branch-filter" {
  uses = "actions/bin/filter@master"
  args = "deleted_branch"
}

Optionally supply a pattern of branches to match:

  args = "deleted_branch stable-*"

ref

Continue if the event ref matches a pattern.

action "branch-filter" {
  uses = "actions/bin/filter@master"
  args = "ref refs/pulls/*"
}

label

Continue if the issue or pull request has the following label

action "label-filter" {
  uses = "actions/bin/filter@master"
  args = "label urgent"
}

issue_comment

Continue if the issue or pull request has the following issue_comment

action "issue-comment-filter" {
  uses = "actions/bin/filter@master"
  args = "issue_comment lgtm"
}

action

Continue if the event payload includes a matching action.

action "action-filter" {
  uses = "actions/bin/filter@master"
  args = "action synchronize"
}

This also supports multiple actions.

action "action-filter" {
  uses = "actions/bin/filter@master"
  args = "action 'opened|synchronize'"
}

actor

Continues when the initiator of a workflow matches a GitHub username.

action "actor-filter" {
  uses = "actions/bin/filter@master"
  args = "actor octocat"
}

This also supports multiple possible actors:

action "actor-filter" {
  uses = "actions/bin/filter@master"
  args = ["actor", "octocat", "torvalds"]
}

not

Used to provide the logical opposite of other filters.

action "tag-filter" {
  uses = "actions/bin/filter@master"
  args = "not actor octocat"
}

environment

Continue if the event payload includes a matching environment.

action "environment-filter" {
  uses = "actions/bin/filter@master"
  args = "environment production"
}

This also supports multiple environments.

action "environment-filter" {
  uses = "actions/bin/filter@master"
  args = ["environment", "staging", "production"]
}

License

The Dockerfile and associated scripts and documentation in this project are released under the MIT License.

Container images built with this project include third party materials. See THIRD_PARTY_NOTICE.md for details.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.