trigger-circleci-pipeline-action icon indicating copy to clipboard operation
trigger-circleci-pipeline-action copied to clipboard

Bug: Example in documentation causes yaml error

Open realnc opened this issue 3 years ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current behavior

This example shown in the documentation on how to avoid double execution does not work:

workflows:
  # This workflow is set to be conditionally triggered,
  # only via the GitHub Action.
  # With no other unfiltered workflows, normal push events will be ignored.
  when: << pipeline.parameters.GHA_Action >>
  test:
    jobs:
      - test

It causes the CircleCI pipeline to fail with:

#!/bin/sh -eo pipefail
# ERROR IN CONFIG FILE:
# [#/workflows/when] only 0 subschema matches out of 2
# 1. [#/workflows/when] expected type: Mapping, found: String
# |   SCHEMA:
# |     type: object
# |   INPUT:
# |     << pipeline.parameters.GHA_Action >>
# 2. [#/workflows/when] subject must not be valid against schema {\"description\":\"cannot use both 'when' and 'unless'\",\"allOf\":[{\"required\":[\"when\"]},{\"required\":[\"unless\"]}]}
# |   SCHEMA:
# |     not:
# |       description: cannot use both 'when' and 'unless'
# |       allOf:
# |       - required:
# |         - when
# |       - required:
# |         - unless
# |   INPUT:
# |     << pipeline.parameters.GHA_Action >>

Minimum reproduction code

https://gist.github.com/realnc/796e8302d6e546c95fd4e274b9686091

Steps to reproduce

No response

Expected behavior

when: << pipeline.parameters.GHA_Action >> should prevent the workflow from running rather than resulting in the pipeline to fail.

GitHub Action Version

1.0.4

Other

No response

realnc avatar May 12 '22 15:05 realnc

+1 When using the documented sample I see the pipeline fails with the following error "All Workflows have been filtered from this Pipeline. No Jobs have been run." The problem is that this error is now translated in a PR check fail that shows with red (as shown below) even if the workflow was successfully triggered and all the CI checks passed: Screenshot 2023-09-06 at 6 30 26 PM

emdobrin avatar Sep 07 '23 01:09 emdobrin