.github/workflows/repo_linter.sh

61264dab2ac860912413c49c7676e07b7c8b6e9b
awesome/.github/workflows/repo_linter.sh history · blame · raw

22 lines · 568 bytes · executable

 1#!/bin/bash
 2
 3# Find the repo in the git diff and then set it to an env variables.
 4REPO_TO_LINT=$(
 5	git diff main -- readme.md |
 6	# Look for changes (indicated by lines starting with +).
 7	grep ^+ |
 8	# Get the line that includes the readme.
 9	grep -Eo 'https.*#readme' |
10	# Get just the URL.
11	sed 's/#readme//')
12
13# If there's no repo found, exit quietly.
14if [ -z ${REPO_TO_LINT+x} ]; then
15	echo "No new link found in the format:  https://....#readme"
16else
17	echo "Cloning $REPO_TO_LINT"
18	mkdir cloned
19	cd cloned
20	git clone --depth=1 "$REPO_TO_LINT" .
21	npx awesome-lint
22fi