microadam / drone-config-changeset-conditional

The Unlicense
65 stars 17 forks source link

Fails when YAML contains comments #24

Open agrrh opened 4 years ago

agrrh commented 4 years ago

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

...
agrrh commented 4 years ago

Probably would be fixed by #17