A GitHub Actions that report to visualize dependencies of changed files each pull requests.
This action uses dependency-cruiser to output syntax of mermaid.js. Inspired by jest-coverage-report-action.
npm install --save-dev dependency-cruisernpm run depcruise --initname: 'depcruise'
on:
pull_request:
jobs:
report:
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: MH4GF/dependency-cruiser-report-action@v2This action automatically detects dependency-cruiser config file ( .dependency-cruiser.js, etc.), but you can specify your own rules file.
with:
config-file: my-rules.jsonFor more information on config file, please see the official documentation
This action automatically adds necessary flags to your cruise script. The default script is:
yarn run -s depcruiseSo you don't need to specify additional flags - action will handle them automatically. So, after adding necessary flags, action will run this command:
--output-type mermaid --config ${SPECIFIED_CONFIG_FILE} ${DIFF_FILE_A DIFF_FILE_B ...etc}But you can use additional options:
with:
cruise-script: yarn run -s depcruise --exclude "^lib"This action will automatically download dependencies (default is yarn), but you can also specify bun, npm or pnpm:
with:
package-manager: npmor
with:
package-manager: pnpmIf you want to run this action in another directory, specify working-directory:
with:
working-directory: <dir>This action requires dependency-cruiser v11.10.0 or newer.

