CircleCI-Public / trigger-circleci-pipeline-action

Trigger a CircleCI pipeline from any GitHub Actions event.
https://github.com/marketplace/actions/trigger-circleci-pipeline
47 stars 43 forks source link

Bug: Example in documentation causes yaml error #17

Open realnc opened 2 years ago

realnc commented 2 years ago

Is there an existing issue for this?

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

emdobrin commented 1 year ago

+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