leo/.github/workflows/markdown.yml

48 lines
1.2 KiB
YAML
Raw Normal View History

2020-06-14 04:05:40 +03:00
name: Markdown Compiler
2020-06-14 04:10:42 +03:00
on:
push:
paths:
- '**/*.md'
2020-06-14 04:05:40 +03:00
jobs:
2020-06-14 04:10:42 +03:00
build:
name: Run
2020-06-14 04:05:40 +03:00
runs-on: ubuntu-latest
steps:
2020-06-16 02:26:43 +03:00
- uses: actions/checkout@v2
2020-06-14 04:26:26 +03:00
with:
fetch-depth: 2
2020-06-14 04:10:42 +03:00
- 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 }}
2020-06-14 04:05:40 +03:00
- name: Compile mermaid
2020-06-14 04:10:42 +03:00
uses: neenjaw/compile-mermaid-markdown-action@master
with:
files: ${{ steps.getfile.outputs.files }}
output: '.resources'
env:
HIDE_CODEBLOCKS: 1
2020-06-16 01:24:36 +03:00
ABSOLUTE_IMAGE_LINKS: 1
2020-06-14 04:10:42 +03:00
- name: Show changes
run: git status
- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
2020-06-16 03:12:29 +03:00
git add .
2020-06-16 03:38:14 +03:00
git diff-index --quiet HEAD || git commit -m "Add markdown changes"
2020-06-14 04:10:42 +03:00
- name: Push changes
2020-06-16 03:02:14 +03:00
uses: ad-m/github-push-action@master
2020-06-14 04:10:42 +03:00
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
2020-06-16 03:06:06 +03:00
branch: ${{ github.ref }}