chaspy / gh-monorepo-dep-doctor

gh extension to execute dep-doctor in monorepo for direct dipendencies.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gh-monorepo-dep-doctor go Go Report Card

gh extension to execute dep-doctor in monorepo for direct dipendencies.

Motivation

  1. I want to run dep-doctor on monorepo for all target services at once.

  2. I want to detect only direct dependencies. dep-doctor's feature is that it detects the maintenance state of dependencies of dependencies, but I noticed that the detected ones are not controllable for me.

  3. I want to notify Slack of the output results of dep-doctor. For this purpose, output in a format that can be handled programmatically is preferred. (dep-doctor is output in text.) In this tool, we implemented it in csv.

  4. [Ruby] I wanted to check only official gems, and exclude forked gems and in-house gems from the diagnoses.

Requirement

Support Language

  • Ruby, bundle

Installation

gh extension install chaspy/gh-monorepo-dep-doctor

To upgrade,

gh extension upgrade chaspy/gh-monorepo-dep-doctor

Usage

gh monorepo-dep-doctor

Output is like below.

api/Gemfile,grape-cache_control,not-maintained,https://github.com/karlfreeman/grape-cache_control
api/Gemfile,http_accept_language,not-maintained,https://github.com/iain/http_accept_language
back-office/Gemfile,sass,archived,https://github.com/sass/ruby-sass

A CSV file of the form depenedency file, library, status, url will be output

Note

As it is executed asynchronously, the order of output is not guaranteed

Ignore file

To ignore a specific library, you can create a .gh-monorepo-dep-doctor-ignore file in the root of the repository.

The format of the file is as follows.

# This file allow a comment with "#"
# Lines beginning with # and blank lines are ignored
# Also, files beginning with "#" are ignored.
library-name
another-library-name # You can leave a comment here

Notification to Slack

If you want to notify the result of gh-monorepo-dep-doctor to Slack, use Incoming Webhook.

gh monorepo-dep-doctor >> result.csv 
SLACK_WEBHOOK_URL="please-add-webhook-url"

while IFS=, read -r file_path package_name maintenance_status url
do
  app=$(echo $file_path | cut -d'/' -f1)
  group_handle="group-handle-to-notify"
  group_id="group-id-to-notify"
  message=$(cat <<EOF
<!subteam^${group_id}|${group_handle}> The package *${package_name}* used by ${app} is in *${maintenance_status}*. Details: ${url}
EOF
)
echo $message
curl -X POST -H 'Content-type: application/json' \
  --data "{\"text\": \"$message\"}" \
  $SLACK_WEBHOOK_URL
done < result.csv

Environment Variables

Name Description
MAX_CONCURRENCY The maximum number of concurrentcy. Defaults to 10.

About

gh extension to execute dep-doctor in monorepo for direct dipendencies.


Languages

Language:Go 99.3%Language:Shell 0.7%