目录

Markdown to Output Action

units-test

GitHub Action that parses a markdown file to action output. Supports frontmatter and templating.

Usage

name: Markdown to Output
on: push
jobs:
  markdown-output:
    name: Markdown to Output
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3 
      - uses: markpatterson27/markdown-to-output@v1
        id: mto
        with:
          filepath: examples/project.md
      - run: |
          echo ${{ steps.mto.outputs.attributes }}
          echo ${{ steps.mto.outputs.body }}

Inputs

Input Name Required Default Description
filepath yes none Path to markdown file.

Outputs

Output Name Description
attributes Array of parsed front matter attributes. Attribute names are converted to lowercase kebab-case with special characters removed.
body Main body content of file.

Additionally, each attribute name will have it’s own output.

Similar projects / Inspiration

  • Markdown Meta - doesn’t output body of file, just front matter attributes
  • Create an Issue Action - file processed to creating issues. no output of file data. goal to do something similar, but want to decouple the process

if just looking to read file contents to step output

- id: read-file
  run: echo "::set-output name=contents::$(cat filename.txt)" # doesn't remove CR. does remove LF :(
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802047560号