8000 GitHub - shiftcode/github-action-skip at ee0b8fd32b5a7cdf039ea2960f1318be7fbb3ce3
[go: up one dir, main page]

Skip to content

shiftcode/github-action-skip

Repository files navigation

shiftcode/github-action-skip

Github Actions have native support to skip an entire workflow depending on commit message. But since we rely on status checks for our Pull Requests to be green, we need another option.

This action accepts an input string skipOnCommitMsg which will be used to check if the commit message contains the given string. If yes the output shouldExecute will be set to false. true otherwise. For full input / output list and other configurations check action.yml.

Example GitHub Workflow definition

This example shows how to setup two dependant jobs, the second will only be executed if the output from checkExecution job is false.

# jobs
checkExecution:
    runs-on: ubuntu-latest
    outputs:
      shouldExecute: ${{steps.step1.outputs.shouldExecute}}
    steps:
      - name: Check for execution
        uses: shiftcode/github-action-skip@releases/v2-alpha.0
        with:
          skipOnCommitMsg: "[skip_workflow]"
  build:
    runs-on: ubuntu-latest
    needs: checkExecution
    if: needs.checkExecution.outputs.shouldExecute
    steps:

Publish to a distribution branch

Actions will be consumed from GitHub repos. All the dependencies must be pushed there. This means for JS also node_module must be published.

Comment out node_modules in .gitignore and create a releases/** branch

# comment out in distribution branches
# node_modules/

Then run the following commands:

$ git checkout -b releases/v1
$ npm prune --production
$ git add node_modules
$ git commit -a -m "prod dependencies"
$ git push origin releases/v1

Your action is now published! 🚀

See the versioning documentation

Usage:

After testing you can create a v1 tag to reference the stable and tested action

uses: shiftcode/github-action-skip@v1
with:
  skipOnCommitMsg: "[skip build]"
  githubtoken: ${{secrets.GH_TOKEN}}

About

skips a github action based on some input parameter

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  
0