Giter Site home page Giter Site logo

marcello3d / compile-mermaid-markdown-action Goto Github PK

View Code? Open in Web Editor NEW

This project forked from neenjaw/compile-mermaid-markdown-action

0.0 2.0 0.0 48 KB

A github action to compile mermaid markdown into images. All the graph, none of the toolchain.

Dockerfile 2.37% Shell 79.02% Awk 18.61%

compile-mermaid-markdown-action's Introduction

compile-mermaid-markdown-action (beta)

Purpose

Markdown is a common way to present useful information with rich formatting from a simple human readable syntax. Especially useful is being able to highlight code blocks.

Mermaid-JS takes this philosophy and applies it to graphs! Taking simple human-readable syntax and returning rich graphs.

Github markdown does not automatically render mermaid to the browser, so this action does that for you so you can just worry about the markdown and not the toolchain.

Contributing

Looking for suggestions/help in improving this action. If there is a feature you want, or you encounter a bug, please let me know and we can work together to improve it.

How to use

The idea is that this action is to be used within a workflow, not as a standalone action at this time.

Sample workflow with automated PR

(adapted from my example repo:

name: 'Compile Mermaid'

on:
  push:
    paths:
      - '**/*.mermaid'
      - '**/*.md'

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: 2
    - name: get changed files
      id: getfile
      run: |
        echo "::set-output name=files::$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep -e '.*\.md$' -e '.*\.mermaid$' | xargs)"

    - name: mermaid files changed
      run: |
        echo ${{ steps.getfile.outputs.files }}

    - name: compile mermaid
      uses: neenjaw/compile-mermaid-markdown-action@master
      with:
        files: ${{ steps.getfile.outputs.files }}
        output: 'output'
      env:
        HIDE_CODEBLOCKS: 1

    - name: show changes
      run: |
        git status

    - name: Create Pull Request
      id: cpr
      uses: peter-evans/create-pull-request@v2
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
        commit-message: Add compiled mermaid
        title: '[MMDC] New mermaid files compiled'
        body: |
          - Auto-generated by [create-pull-request][1]

          [1]: https://github.com/peter-evans/create-pull-request
        labels: report, automated pr
        assignees: neenjaw
        reviewers: neenjaw
    - name: Check outputs
      run: |
        echo "Pull Request Number - ${{ env.PULL_REQUEST_NUMBER }}"
        echo "Pull Request Number - ${{ steps.cpr.outputs.pr_number }}"

Sample workflow with changes pushed

name: 'Compile Mermaid in Markdown'

on:
  push:
    paths:
      - '**/*.md'

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: 2

    - name: get changed files
      id: getfile
      run: |
        echo "::set-output name=files::$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep -e '.*\.md$' | xargs)"

    - name: md files changed
      run: |
        echo ${{ steps.getfile.outputs.files }}

    - name: compile mermaid
      uses: neenjaw/compile-mermaid-markdown-action@master
      with:
        files: ${{ steps.getfile.outputs.files }}
        output: '.resources'
      env:
        HIDE_CODEBLOCKS: 1

    - name: show changes
      run: |
        git status

    - name: Commit files
      run: |
        git config --local user.email "[email protected]"
        git config --local user.name "GitHub Action"
        git commit -m "Add changes" -a

    - name: Push changes
      uses: ad-m/github-push-action@master
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}

compile-mermaid-markdown-action's People

Contributors

neenjaw avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.