Skip to content
This repository was archived by the owner on Nov 16, 2021. It is now read-only.

yzAlvin/action-yaml-front-matter

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

Front Matter to JSON Action

Parse the front matter / markdown metadata of files in a directory into a JSON array.

This action outputs a JSON array which can be commited as a file, and is useful for CI purposes.

Inputs

input-directory

Required The path to the directory containing files with front matter.

An example file in the directory might look like:

---
name: QWERTY 
date: 2000-01-01
slug: qwerty 
excerpt: A popular keyboard layout 
---
Qwerty is the first keyboard layout many ....... 
...

content-field

The name of the field containing everything after the front matter. Defaults to content

Outputs

output

The JSON array containing the front matter and content.

It's shape will look like this:

[
  {
    "frontmatter1": "value",
    "frontmatter2": "value",
    "frontmatterN": "value",
    "content": "content"
  },
  {
    "frontmatter1": "value",
    "frontmatter2": "value",
    "frontmatterN": "value",
    "content": "content"
  },
  ...
]

Example usage

uses: actions/checkout@v2
uses: yzalvin/action-yaml-front-matter@v1
with:
  input-directory: './demo'
  content-field: 'description'

About

creates json from yaml front matter

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •