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.
-
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
-
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: [email protected] # commit_message: Diagrams generated with [Infrastructure Diagram Action](https://github.com/olmesm/infrastructure-diagram-action) # disable_review_comment: false
-
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>
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. |
- Create a test branch with the script
sh scripts/create-test-pr.sh
- Check the generated diagram matches _documentation/diagrams/advancedweb_service_with_on-premise(...).png to ensure no regression.
sh ./scripts/release.sh "release message"
- Improve speed by building and hosting a release image
- Add additional inputs listed in action.yml