Use with GitHub Actions
Available since v0.9
By combining console2svg with GitHub Actions, you can automatically update README images when repositories are updated or released.
GitHub Actions
Section titled “GitHub Actions”A convenient GitHub Action is also available for CI usage. To use the latest version of console2svg, just add the following step to your workflow:
- uses: arika0093/console2svg@mainSpecify the console2svg version as follows.
- uses: arika0093/console2svg@main with: version: 0.8.3 # Build from source instead # version: developWorkflow examples
Section titled “Workflow examples”One-off generation
Section titled “One-off generation”The following is an example workflow that installs console2svg on an Ubuntu runner, generates an SVG, and commits it to the Git repository.
jobs: gen: runs-on: ubuntu-latest permissions: contents: write steps: - name: Checkout uses: actions/checkout@v7
- name: Setup console2svg uses: arika0093/console2svg@main
- name: Generate SVG run: console2svg capture -w 120 -c -d macos-pc -o output.svg -- dotnet --version
- name: Commit Changes uses: stefanzweifel/git-auto-commit-action@v7 with: commit_message: "[skip-ci] chore: regenerate SVG"Automatic sync
Section titled “Automatic sync”You can also automatically update documentation by using the batch markdown feature. The following is an example workflow that detects markers in Markdown, generates images, and commits them.
jobs: sync: runs-on: ubuntu-latest permissions: contents: write steps: - name: Checkout uses: actions/checkout@v7
- name: Setup console2svg uses: arika0093/console2svg@main
- name: Generate SVGs from Markdown run: console2svg batch markdown -i ./docs -o ./assets
- name: Commit Changes uses: stefanzweifel/git-auto-commit-action@v7 with: commit_message: "[skip-ci] chore: regenerate SVGs"Automatic environment variable overrides
Section titled “Automatic environment variable overrides”Some libraries (for example, chalk) detect CI environments and automatically disable color output. However, when generating SVG, you almost certainly want colors to always be enabled. Therefore, console2svg automatically sets and deletes the following environment variables by default:
TERM=xterm-256color: Set to enable color support.COLORTERM=truecolor: Enables TrueColor output.FORCE_COLOR=3: Same as above.3indicates TrueColor.CI(deleted): Removed intentionally because libraries disable colors when they detect a CI environment.TF_BUILD(deleted): Removed for the same reason (used by Azure Pipelines).
Use the --no-colorenv and --no-delete-envs options to disable this behavior.