Skip to content

CI and automation

Commit a metro-map .mmd to your pipeline repo and let automation keep the rendered SVG in sync. nf-metro ships two integrations:

  • A composite GitHub Action that installs nf-metro and renders the map, leaving you to decide what to do with the result.
  • A pre-commit hook that re-renders the SVG locally on every commit.

The composite action renders the map and reports whether the SVG changed.

- uses: actions/checkout@v4
- uses: seqeralabs/nf-metro@2.0.0
id: metro
with:
input: assets/metro_map.mmd
theme: nfcore
embed-font: "true"
# steps.metro.outputs.output-path — where the SVG was written
# steps.metro.outputs.changed — 'true' when it differs from the committed SVG

Every input is optional:

  • input: default assets/metro_map.mmd.
  • output: default is the sibling .svg of the input.
  • theme: default nfcore.
  • mode: no default.
  • embed-font: default true.
  • version: the nf-metro version to install.
  • extra-args: any other nf-metro render flag, such as extra-args: "--fold-threshold 20".

Re-render the SVG locally on every commit so it cannot drift from the source.

.pre-commit-config.yaml
repos:
- repo: https://github.com/seqeralabs/nf-metro
rev: 2.0.0
hooks:
- id: nf-metro

The hook matches *.mmd and writes the sibling .svg. assets/metro_map.mmd becomes assets/metro_map.svg. It runs with --theme nfcore --embed-font by default. Setting args replaces that whole list. Repeat the flags you want to keep alongside the new one:

- id: nf-metro
args: [--theme, nfcore, --embed-font, --mode, light]

Drop --theme nfcore if the map picks its own brand with a %%metro style: directive, which the flag would otherwise override.