mirror of
https://github.com/sindresorhus/awesome.git
synced 2025-11-06 09:34:53 +05:30
Run awesome-lint on new additions (#1962)
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
This commit is contained in:
parent
2573b98bb6
commit
ec9672252a
2 changed files with 36 additions and 0 deletions
14
.github/workflows/main.yml
vendored
Normal file
14
.github/workflows/main.yml
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
on:
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'readme.md'
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: awesome-lint
|
||||
run: ./.github/workflows/repo_linter.sh
|
||||
22
.github/workflows/repo_linter.sh
vendored
Executable file
22
.github/workflows/repo_linter.sh
vendored
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Find the repo in the git diff and then set it to an env variables.
|
||||
REPO_TO_LINT=$(
|
||||
git diff 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+x} ]; then
|
||||
echo "No new link found in the format: https://....#readme"
|
||||
else
|
||||
echo "Cloning $REPO_TO_LINT"
|
||||
mkdir cloned
|
||||
cd cloned
|
||||
git clone --depth=1 "$REPO_TO_LINT" .
|
||||
npx awesome-lint
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue