Why do not action run on branch?

I have a project where to test examples of workflows and for some reason this workflow would not start on my feature-branch… The on: push: branches: feature-docker should be valid. no?

Finding examples of code for workflows in GitHub actions is very hard…

Hi @jactor-rises,

There are some syntax errors in your workflow yaml:

  1. with cannot work with run. Please fix your code in job ‘verify’:
      - name: Fail when not found
        run: |
          if [ "$NOT_FOUND" == "true" ]; then
            exit 1;
          fi
        env:                                                                 # use env instead of with
          NOT_FOUND: ${{ steps.dockerimage.outputs.not_found }}
      - name: Run when found
        run: echo "docker image - $IMAGE - is found"
        if: env.NOT_FOUND != 'true'                                    #remove the extra single quote, and fix the format
        env:                                                                           # use env instead of with
          NOT_FOUND: ${{ steps.dockerimage.outputs.not_found }}
  1. Since you use on: push.branches, please make sure your branch name is ‘feature-docker’.

I forked your repository, and it works on my side.

Please check the syntax doc for more details: https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions.
And you can find more workflow sample here: https://github.com/actions/starter-workflows/tree/master/ci.

Thanks

1 Like