Skip to content

Commit

Permalink
Update linter
Browse files Browse the repository at this point in the history
  • Loading branch information
infosecB committed Oct 24, 2023
1 parent 7937050 commit 730b2fa
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@

name: Awesome Lint

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

# Allows you to run this workflow manually from the Actions tab
branches: [main]
paths:
- 'readme.md'
workflow_dispatch:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: max/[email protected]
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: awesome-lint
run: ./.github/workflows/repo_linter.sh
22 changes: 22 additions & 0 deletions .github/workflows/repo_linter.sh
Original file line number Diff line number Diff line change
@@ -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 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

0 comments on commit 730b2fa

Please sign in to comment.