Persist to workspace skipped in webhook

When I commit to my Github repo everything builds well but when I run build workflow by webhook I get the the notification:

Warning: skipping this step: Missing workflow workspace identifiers, this step must be run in the context of a workflow

and another job doesn’t run :confused:

version: 2
jobs:
  build:
    docker:
      # documented at https://circleci.com/docs/2.0/circleci-images/
      - image: circleci/node:10.13

    working_directory: ~/inveo-gatsby

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "yarn.lock" }}
            # fallback to using the latest cache if no exact match is found
            - v1-dependencies-

      - run: yarn install

      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "yarn.lock" }}

      - run:
          name: Gatsby Build
          command: ./node_modules/.bin/gatsby build

      - persist_to_workspace:
          root: .
          paths:
            - public
  deploy:
    machine:
      enabled: true
    steps:
      - add_ssh_keys
      - attach_workspace:
          at: public

      - run:
          name: Deploy Over SSH
          command: |
            ssh -p 59184 -C coloris@s75.vdl.pl -t "rm -rf *" &&
            scp -P $SSH_PORT -r ~/project/public/public/* $SSH_USER@$SSH_HOST:$SSH_PATH
workflows:
  version: 2
  build-and-deploy:
    jobs:
      - build
      - deploy:
          requires:
            - build
          filters:
            branches:
              only: master

This is webhook that I use:
https://circleci.com/api/v1/project/ppsirius/coloris-theme/tree/master?circle-token=token&build_parameters=build-and-deploy

The API you referenced only works on single jobs. Could you try this API instead as it will trigger the build of the workflow?
https://circleci.com/docs/api/#trigger-a-new-build-by-project-preview

1 Like