Giter Site home page Giter Site logo

depcruise-pull-request's Introduction

Depcruise PR Check - GitHub Actions

What is it ?

GitHub action to comment depcruise report to a pull request, also provides an optional status check for the job.

Usage

Classic usage

on: pull_request

jobs:
  example_depcruise_pr:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
      checks: write
    name: An example job to comment depcruise report to a PR
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Depcruise
        uses: josteph/[email protected]
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Specifying which pull request to comment on

You can explicitly input which pull request should be commented on by passing the pr_number input. That is particularly useful for manual workflow for instance (workflow_run).

...
- name: Depcruise
  uses: josteph/[email protected]
  with:
    pr_number: 100 # This will comment on pull request #100
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Specifying baseDir and depcruise config file

You can also override the baseDir and depcruise config file path. The path must be relative to root directory.

...
- name: Depcruise
  uses: josteph/[email protected]
  with:
    depcruise_base_dir: 'packages/monorepo-a'
    depcruise_config: 'packages/monorepo-a/.dependency-cruiser.js'
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Permissions

Minimum permissions for this GitHub action to work correctly:

permissions:
  contents: read
  pull-requests: write
  checks: write

Inputs

Action inputs

Name Description Required Default
GITHUB_TOKEN Token that is used to create comments โœ…
depcruise_base_dir The baseDir for depcruise to start the scanning 'src'
depcruise_config Path to the config file for depcruise. ./.dependency-cruiser.js
pr_number The number of the pull request where to create the comment current PR number (deduced from context)
comment_includes The text that should be used to find comment in case of replacement. 'Forbidden dependency check'
status_check If there is any rules violation detected, it will exit the job with status code. true

Build

The build steps bundles the src/main.ts to lib/index.js which is used in a NodeJS environment. It is handled by esbuild compiler.

$ npm run build

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.