Commit ec9672252a

ec9672252a2cddca52f0e154bdd8444a48f3913b

parent: 2573b98bb6

Unregistered key

Raymond Berger <RayBB@users.noreply.github.com> · 2021-04-19 09:59 UTC
committer: <noreply@github.com>

Run `awesome-lint` on new additions (#1962)

Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>

Layout: unified · split

.github/workflows/main.yml added +14
@@ -0,0 +1,14 @@
1on:
2 pull_request:
3 branches: [main]
4 paths:
5 - 'readme.md'
6jobs:
7 lint:
8 runs-on: ubuntu-latest
9 steps:
10 - uses: actions/checkout@v2
11 with:
12 fetch-depth: 0
13 - name: awesome-lint
14 run: ./.github/workflows/repo_linter.sh
.github/workflows/repo_linter.sh added +22
@@ -0,0 +1,22 @@
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