Skip to content

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

License

Notifications You must be signed in to change notification settings

markpatterson27/markdown-to-output

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

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 :(

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published