JasonEtco / create-an-issue

A GitHub Action for creating a new issue from a template file.
MIT License
267 stars 83 forks source link

YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key #93

Closed njimenezotto closed 3 years ago

njimenezotto commented 3 years ago

Hello @JasonEtco ,

Thanks for your useful Github actions. However, I'm facing an issue reading the following markdown template:

---
title: {{ env.VULNERABILITY_TOOL }} Security Alert
assignees: {{ tools.context.actor }}
labels: vulnerability, {{ env.VULNERABILITY_TOOL }}
---
{{ date('MMMM Do YYYY, h:mm:ss a') }} - Vulnerabilities were found on when running the tool {{ env.VULNERABILITY_TOOL }} on commit {{ tools.context.sha }}.    

Please, check the Github workflow logs and reports.  
Update this issue and the Pull Request information with the founded vulnerabilities.  

Pipeline triggered by {{ tools.context.actor }}  

I'm getting the following exception:

fatal     YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key at line 2, column 7: 
 at generateError (/home/runner/work/_actions/JasonEtco/create-an-issue/v2/dist/index.js:15156:10)
    at throwError (/home/runner/work/_actions/JasonEtco/create-an-issue/v2/dist/index.js:15162:9)
    at readBlockMapping (/home/runner/work/_actions/JasonEtco/create-an-issue/v2/dist/index.js:16062:9)
    at composeNode (/home/runner/work/_actions/JasonEtco/create-an-issue/v2/dist/index.js:16348:12)
    at readDocument (/home/runner/work/_actions/JasonEtco/create-an-issue/v2/dist/index.js:16514:3)
    at loadDocuments (/home/runner/work/_actions/JasonEtco/create-an-issue/v2/dist/index.js:16577:5)
    at load (/home/runner/work/_actions/JasonEtco/create-an-issue/v2/dist/index.js:16603:19)
    at safeLoad (/home/runner/work/_actions/JasonEtco/create-an-issue/v2/dist/index.js:16626:10)
    at parse (/home/runner/work/_actions/JasonEtco/create-an-issue/v2/dist/index.js:12421:20)
    at Object.extractor [as default] (/home/runner/work/_actions/JasonEtco/create-an-issue/v2/dist/index.js:12383:12)

The problem is triggered by assignees and labels. This try failed on assigneees:

assignees:
  - {{ tools.context.actor }}

When labels failed, I also tried this format:

labels:
  - vulnerability
  - {{ env.VULNERABILITY_TOOL }}

It seems those lists only work with constant strings.

Could you help me, please?

Thanks!

njimenezotto commented 3 years ago

I've found a way thanks to this issue. This template compiles

---
title: "{{ env.VULNERABILITY_TOOL }} Security Alert"
assignees: "{{ tools.context.actor }}"
labels: "vulnerability, {{ env.VULNERABILITY_TOOL }}"
---
{{ env.DATE_NOW }} - Vulnerabilities were found on when running the tool {{ env.VULNERABILITY_TOOL }} on commit {{ tools.context.sha }}.

Please, check the Github workflow logs and reports.
Update this issue and the Pull Request information with the founded vulnerabilities.

Pipeline triggered by {{ tools.context.actor }}