puml-for-markdown 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.1.0
4
+
5
+ - Add a GitHub Action, `danielyaa5/puml-for-markdown@v2`. `update` mode regenerates
6
+ diagrams and commits only the files it changed; `check` mode fails pull requests
7
+ whose diagrams are out of date. Works on Linux, macOS, and Windows runners.
8
+ See [GitHub Action](./README.md#github-action). No CLI changes.
9
+
3
10
  ## 2.0.1
4
11
 
5
12
  - Correct outdated README statements about Windows support, automated testing,
package/README.md CHANGED
@@ -80,11 +80,64 @@ Requires **Node.js 22 or newer** (Node.js 24 recommended for development).
80
80
 
81
81
  Version 2 raises the minimum Node.js version to 22. Upgrade Node.js before upgrading
82
82
  from version 1. Existing dependencies pinned to `1.x` or `^1.2.1` stay on version 1;
83
- installing `latest` will select version 2 once it is published. See the
83
+ installing `latest` selects version 2. See the
84
84
  [release notes](./CHANGELOG.md) for the changes.
85
85
 
86
86
  `npm i -g puml-for-markdown`
87
87
 
88
+ ### GitHub Action
89
+ Keep diagrams current without running the CLI yourself. To regenerate and commit them on every push to `main`:
90
+
91
+ ```yaml
92
+ # .github/workflows/diagrams.yml
93
+ name: Diagrams
94
+ on:
95
+ push:
96
+ branches: [main]
97
+ permissions:
98
+ contents: write
99
+ jobs:
100
+ diagrams:
101
+ runs-on: ubuntu-latest
102
+ steps:
103
+ - uses: actions/checkout@v4
104
+ - uses: danielyaa5/puml-for-markdown@v2
105
+ ```
106
+
107
+ To fail pull requests whose diagrams are out of date instead:
108
+
109
+ ```yaml
110
+ name: Diagrams
111
+ on: pull_request
112
+ jobs:
113
+ diagrams:
114
+ runs-on: ubuntu-latest
115
+ steps:
116
+ - uses: actions/checkout@v4
117
+ - uses: danielyaa5/puml-for-markdown@v2
118
+ with:
119
+ mode: check
120
+ ```
121
+
122
+ | Input | Default | Description |
123
+ |---|---|---|
124
+ | `mode` | `update` | `update` regenerates links and images, then commits and pushes them. `check` regenerates and fails if anything differs from what is committed. |
125
+ | `args` | | Extra CLI options, such as `--local-images -f svg` or `-s https://uml.example.com/plantuml`. Use the options you run locally, or `check` will report differences. |
126
+ | `root-directory` | `.` | Project directory to scan. |
127
+ | `commit` | `true` | In `update` mode, commit and push the changed files. Needs `permissions: contents: write`. |
128
+ | `commit-message` | `Update PlantUML diagrams` | Commit message for `update` mode. |
129
+ | `cache` | `true` | Restore `.puml-cache.json` from earlier runs, and save it in `update` mode, so unchanged diagrams are not rendered or shortened again. |
130
+
131
+ Outputs: `changed` (`true` or `false`), `files` (changed paths, one per line), and `commit` (the pushed SHA).
132
+
133
+ - The action commits only the files the CLI changed, never other changes made earlier in the job, and never `.puml-cache.json`.
134
+ - Commits pushed with the default `GITHUB_TOKEN` do not start new workflow runs, so updates cannot loop.
135
+ - `update` needs a branch checkout. On `pull_request` events use `check`, which also works for forks, or check out `${{ github.head_ref }}` for pull requests from the same repository.
136
+ - `check` contacts the same renderer and shortener as a normal run. TinyURL returns the same link for the same diagram, so a pull request regenerated locally passes. With `-t` and no image export, `check` needs no network.
137
+ - For Polr, pass the key from a secret: `env: POLR_APIKEY: ${{ secrets.POLR_APIKEY }}`.
138
+ - The action uses the runner's Node.js when it is version 22 or newer, and otherwise installs Node.js 22. Linux, macOS, and Windows runners are supported.
139
+ - `@v2` follows the latest 2.x release. Pin a release such as `@2.1.0`, or a commit SHA, to control updates.
140
+
88
141
  ### Advanced Usage
89
142
  Here are some other features supported
90
143
  - You can specify the CLI to output the diagram images as png and/or svg see `--output-images` and `--image-formats`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "puml-for-markdown",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "An application to add interactive PUML diagrams to your github markdown files. If running with default arguments, run in project root directory.",
5
5
  "main": "index.js",
6
6
  "scripts": {