awesome/.github/workflows/repo_linter.sh
Vishwanath Martur fdbf48b097 Add CI to automate heavy PR load
Related to #1365

Implement CI to automate heavy PR load using `awesome-lint`.

* **.github/workflows/main.yml**
  - Add a step to run `awesome-lint` on `readme.md` after the checkout step.
* **.github/workflows/repo_linter.sh**
  - Add `npx awesome-lint` command to lint the repository after cloning.
* **readme.md**
  - Mention the usage of `awesome-lint` for CI in the introduction.
  - Add a section about `awesome-lint` in the "Contribution guide".
* **contributing.md**
  - Add instructions for running `awesome-lint` before submitting a PR.
  - Mention the requirement to pass `awesome-lint` in the PR guidelines.
2025-03-09 23:46:28 +05:30

26 lines
622 B
Bash

#!/bin/bash
# Find the repo in the git diff and then set it to an env variables.
REPO_TO_LINT=$(
git diff origin/main -- readme.md |
# Look for changes (indicated by lines starting with +).
grep ^+ |
# Get the line that includes the readme.
grep -Eo 'https.*#readme' |
# Get just the URL.
sed 's/#readme//')
# If there's no repo found, exit quietly.
if [ -z "$REPO_TO_LINT" ]; then
echo "No new link found in the format: https://....#readme"
else
echo "Cloning $REPO_TO_LINT"
mkdir cloned
cd cloned
git clone "$REPO_TO_LINT" .
npx awesome-lint
fi
# Lint the repository using awesome-lint
npx awesome-lint