Skip to content

Fails when YAML contains comments #24

@agrrh

Description

@agrrh

When I add comment to my .drone.yml, plugin fails with:

Files changed: [ '.drone.yml' ]
(node:1) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'kind' of null
    at parsedYaml.map (/app/plugin.js:49:12)
    at Array.map (<anonymous>)
    at app.post (/app/plugin.js:48:36)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)

Issue reproduces with following YAML:

# Section 1                     <-- This causes plugin to fail
---

kind: pipeline
type: docker
name: foo

...

# Section 2                     <-- And this, too
---

kind: pipeline
type: docker
name: bar

...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions