I want to create on the fly a golang
template file in GitHub Actions.
So I am doing more or less the following:
<code> - name: create the template
shell: bash
run: |
cat <<EOF > myfile.tpl
{{- if . }}
{{- range . }}
<h3>Target <code>{{ escapeXML .Target }}</code></h3>
{{- if (eq (len .Vulnerabilities) 0) }}
<h4>No Vulnerabilities found</h4>
.
.
{{- end }}
EOF
</code>
<code> - name: create the template
shell: bash
run: |
cat <<EOF > myfile.tpl
{{- if . }}
{{- range . }}
<h3>Target <code>{{ escapeXML .Target }}</code></h3>
{{- if (eq (len .Vulnerabilities) 0) }}
<h4>No Vulnerabilities found</h4>
.
.
{{- end }}
EOF
</code>
- name: create the template
shell: bash
run: |
cat <<EOF > myfile.tpl
{{- if . }}
{{- range . }}
<h3>Target <code>{{ escapeXML .Target }}</code></h3>
{{- if (eq (len .Vulnerabilities) 0) }}
<h4>No Vulnerabilities found</h4>
.
.
{{- end }}
EOF
However, apart from the fact that I get errors when trying to use it, when I cat
it I get the following
<code>******- if . ******
******- range . ******
<h3>Target <code>*** escapeXML .Target ***</code></h3>
******- if (eq (len .Vulnerabilities) 0) ******
<h4>No Vulnerabilities found</h4>
</code>
<code>******- if . ******
******- range . ******
<h3>Target <code>*** escapeXML .Target ***</code></h3>
******- if (eq (len .Vulnerabilities) 0) ******
<h4>No Vulnerabilities found</h4>
</code>
******- if . ******
******- range . ******
<h3>Target <code>*** escapeXML .Target ***</code></h3>
******- if (eq (len .Vulnerabilities) 0) ******
<h4>No Vulnerabilities found</h4>
What is the proper way of going about it?