Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Test #3577

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/add-mermaid-diagram.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Mermaid Diagram for PRs

on: [pull_request]

jobs:
generate-mermaid-diagram:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Generate Mermaid Diagram
uses: gr2m/render-mermaid-action@v1
with:
input: diagram.mmd
output: diagrams/diagram.png

- name: Commit and Push Diagram to PR Branch
uses: stefanzweifel/[email protected]
with:
commit_message: "Automatically rendered Mermaid diagrams"
file_pattern: "diagrams/*.png diagrams/*.svg"
branch: ${{ github.head_ref }}

- name: Upload Mermaid Diagram as Artifact
uses: actions/upload-artifact@v4
with:
name: mermaid-diagram
path: diagrams/diagram.png

- name: Add Comment to PR with Mermaid Diagram
run: |
PR_BRANCH=${{ github.head_ref }}
PR_IMAGE_URL="https://raw.githubusercontent.com/${{ github.repository }}/${PR_BRANCH}/diagrams/diagram.png"
echo "🖼️ **Generated Mermaid Diagram for this PR:**" >> comment.md
echo "![$PR_IMAGE_URL]($PR_IMAGE_URL)" >> comment.md

uses: mshick/add-pr-comment@v2
with:
message-path: comment.md
4 changes: 4 additions & 0 deletions diagram.mmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
graph TD;
A[Start] --> B{Decision};
B -->|Yes| C[Proceed];
B -->|No| D[Stop];
Binary file added diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading