Git Product home page Git Product logo

generate-plantuml-action's Introduction

Maintainability Test Coverage Actions Status

generate-plantuml-action

Generate uml diagrams with Plantuml Server and push them to your repository.

This action ease you to maintain UML. UML is very useful, but there are some difficulties to maintain. PlantUML enables you to write UML with text code, that is engineer-friendly so you would like it.

This actions generate UML diagrams from plantuml code with PlantUML Server when you commit plantUML files or Markdown files that plantuml code is written in.

PlantUML files must end in either of

  • .pu
  • .pml
  • .puml
  • .plantuml

Markdown files must end in

  • .md
  • .markdown
  • .mdown
  • .mkdn
  • .mdwn
  • .mkd
  • .mdn
  • .md.txt

Usage

This Action subscribes to Push events.

name: generate plantuml
on: push
jobs:
  generate_plantuml:
    runs-on: ubuntu-latest
    name: plantuml
    steps:
    - name: checkout
      uses: actions/checkout@v1
      with:
        fetch-depth: 1
    - name: plantuml
      id: plantuml
      uses: grassedge/generate-plantuml-action@v1.5
      with:
        path: example
        message: "Render PlantUML files"
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

input

  • path : specify the path to save generated svg files
    the default (.) saves each SVG file in the same folder as the source file it was generated from
  • message : specify the commit message for the commit of generated svg files (defaults to Render PlantUML files)

env

  • GITHUB_TOKEN : required GitHub Token of your repository to commit svg files.

Demo

see examples here.

License

The scripts and documentation in this project are released under the MIT License.

generate-plantuml-action's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar grassedge avatar jhwanicity avatar patped avatar simonppg avatar wyrfel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

generate-plantuml-action's Issues

Unable to generate images on branches

I've managed to setup the action for the master branch, but I'd like to also generate images on other branches, so that my reviewers can read our documentation with consistent diagrams during their reviews.

My workflow is the following:

name: Generate diagrams
on: push
jobs:
  generate_plantuml:
    runs-on: ubuntu-latest
    name: plantuml
    steps:
    - uses: actions/checkout@v2
    - name: plantuml
      uses: grassedge/generate-plantuml-action@master
      with:
        path: diagrams
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Unfortunately, it does not work on branches other than master, for example on feat/mvpVersion:

Set up job
Run actions/checkout@v2
remote: Counting objects:  94% (18/19)        
Run actions/checkout@v2
Syncing repository: repo
Getting Git version info
Deleting the contents of '/home/runner/work/repo'
Initializing the repository
Disabling automatic garbage collection
Setting up auth
Fetching the repository
Determining the checkout info
Checking out the ref
  /usr/bin/git checkout --progress --force -B feat/mvpVersion refs/remotes/origin/feat/mvpVersion
  Switched to a new branch 'feat/mvpVersion'
  Branch 'feat/mvpVersion' set up to track remote branch 'feat/mvpVersion' from 'origin'.
/usr/bin/git log -1
commit 712a0ef519c421a60cc9f416f29a01f77ddf2e22
Author: Laurent
Date:   Thu Jun 18 19:13:26 2020 +0200

plantuml
    GITHUB_TOKEN: ***
Run grassedge/generate-plantuml-action@master
There are no files to be generated.

Did I miss something, or the generation only works on master?

Error: HttpError: tree.path contains a malformed path component

When I add a PlantUML diagram to a markdown file the action throws the following error:

Error: HttpError: tree.path contains a malformed path component

image

Seems to be a GitHub API error. It works perfectly fine for .puml files. Here is my workflow:

name: Generate PlantUML
on: push
jobs:
  generate_plantuml:
    runs-on: ubuntu-latest
    name: plantuml
    steps:
    - name: checkout
      uses: actions/checkout@v1
      with:
        fetch-depth: 1
    - name: plantuml
      id: plantuml
      uses: grassedge/[email protected]
      with:
        message: "Render PlantUML files"
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Also tried with path: . set; same error.

The .md file in question:

# Test PlantUML Diagram

Sequence diagram:

` ` `plantuml:test-md-diagram
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
Alice -> Bob: Another authentication Request
Alice <-- Bob: another authentication Response
` ` `

![](./test-md-diagram.svg)

(rendered diagram should appear above)

new release - deprecate node12

the present release v1.5.0 returned node12
the master branch has node16
do you want some assistance with housekeeping PR's?

GitHub Token

Are there any technical reasons why generate-plantuml-action needs access to a GitHub token?

I have seen GitHub actions that commit to the repo without having access to the GitHub token.

Not working with .puml files

We've been scratching our heads on this one!

With a file ending .puml it reports no files found. Rename it to .pml and it bursts to life!

Perhaps something happening at the checkout level?

Handle deleted files properly.

##[error]Error: ENOENT: no such file or directory, open 'path/to/deleted.md'

This action recognizes deleted files as diff and tries to generate svg.
Fix to ignore them.

Cannot read property 'references' of undefined

I've got some issues when running this action on my repo :(

##[error]TypeError: Cannot read property 'references' of undefined
##[error]Node run failed with exit code 1

Here is my yml file :

name: generate plantuml
on: [push]

jobs:
  generate_plantuml:
    runs-on: ubuntu-latest
    name: plantuml
    steps:
    - name: checkout
      uses: actions/checkout@v1
      with:
        fetch-depth: 1
    - name: plantuml
      id: plantuml
      uses: grassedge/[email protected]
      env:
         GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Unable to generate .svgs when PlantUML uses !include for files in parent directory.

I have two files. (Pseudo-representation below, scrubbed for privacy)

One is a large file in a parent directory called definitions.puml
The other file is in a subfolder called architecture.pu

They are arranged like so.

src/definitions.puml

'' DATABASE DEF
!define db_name Name of database
!define db_tech technology: technology desc
!define db_desc Holds data for system.

' ... etc

src/level1/architecture.pu

@startuml
!include ../definitions.puml 

' rest of content below 

@enduml

The outcome is a generated SVG that is "undefined" and has no content.

Github preview reads: Sorry, this file is invalid so it cannot be displayed.

Edit:

I have even tried this format !include %dirpath/../definitions.puml No luck.

Remove add and commit part from this action?

Hey @grassedge .
What do you think about dropping the adding and committing from this action?
There's plenty of actions in the marketplace to do just that and it would enable people to

  • better tailor the commit behaviour to their needs (e.g. create separate PRs, rebase, configure committer etc.)
  • include other changes made by the job in the same commit
  • maybe even not commit but upload the images somewhere else

Is this repo still maintained?

Howdy. Just noticed that #46 is still affecting this code - users get a warning that 'node16' will be used. It's been a while since the last commit on the default branch. Any news? Thanks.

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.