Skip to content

olmesm/infrastructure-diagram-action

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

Infrastructure Diagram Action

This is a GitHub Action to create and commit infrastructure diagrams using the Diagrams tool. This deploy action is meant to be implemented as part of your PR process. This action will also add a review comment of the changes.

Sample of Generated Infrastructure

Usage

  1. Using the syntax defined in Diagrams, create your infrastructure diagrams in the input_dir of your choice (default is _documentation/diagrams).

    See this repo's example here for the diagram above

  2. Add the action to your workflow and the generated diagrams will be added to the PR branch once the workflow completes.

    # .github/workflows/generate-and-commit-diagrams.yml
    name: Generate and commit diagrams
    on:
      pull_request:
        branches: [main]
    
    jobs:
      update-infrastructure-diagrams:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v3
          - name: Infrastructure Diagrams
            uses: olmesm/infrastructure-diagram-action@v1
            with:
              github_token: ${{ secrets.GITHUB_TOKEN }}
              # input_dir: _documentation/diagrams
              # user_name: Bot
              # user_email: default@github-bot.com
              # commit_message: Diagrams generated with [Infrastructure Diagram Action](https://github.com/olmesm/infrastructure-diagram-action)
              # disable_review_comment: false
  3. Reference the generated diagram in your documentation or README file.

  • Use a markdown reference
    ![](_documentation/diagrams/<diagram name as per .py file>.png)
    
  • Use an HTML reference (Note this only works for public repositories. The raw link is not advisable for public facing websites.)
    <a href="https://github.com/<user or org>/<repository>/_documentation/diagrams/<diagram name as per .py file>.png" alt=""></a>
    

Inputs

Required Input Description
yes github_token Set a generated github_token for pushing to the remote branch.
debug debug action
input_dir Set an input directory for processing.
user_name Set Git user.name
user_email Set Git user.email
commit_message Set a custom commit message with a triggered commit hash
disable_review_comment Disable posting a review comment
force_regnerate Force regeneration of all images.
Increases build minutes used. Will only commit if the hash of the output image is different.
debug Enable debugging.

Development

Requires

Development

  1. Create a test branch with the script sh scripts/create-test-pr.sh
  2. Check the generated diagram matches _documentation/diagrams/advancedweb_service_with_on-premise(...).png to ensure no regression.

Release

sh ./scripts/release.sh "release message"

TODO

  • Improve speed by building and hosting a release image
  • Add additional inputs listed in action.yml