Skip to content

Commit

Permalink
Sigh
Browse files Browse the repository at this point in the history
  • Loading branch information
maor-rozenfeld committed Mar 27, 2024
1 parent 5e81aa1 commit 9e8e67a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/prlint.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
name: PR Lint
run-name: PR Lint - ${{ jobs.prlint-reloaded.outputs.verdict || 'Validating...' }}
on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']
jobs:
prlint-reloaded:
runs-on: ubuntu-latest
outputs:
verdict: ${{ steps.3.outputs.verdict || steps.2.outputs.verdict || steps.1.outputs.verdict || 'Unknown' }}
steps:
- uses: maor-rozenfeld/prlint-reloaded@v1
id: '1'
with:
title-regex: ^[A-Z][a-z]+?\s
error-message: Your title must start with a capital letter, and a real word, e.g. 'Add GO support'
- uses: maor-rozenfeld/prlint-reloaded@v1
id: '2'
with:
title-regex: ^\S+\s+\S+\s+\S+
error-message: Your title must have at least three words
- uses: maor-rozenfeld/prlint-reloaded@v1
id: '3'
with:
title-regex: ^(?!\S+ing\s)(?!\S+ed\s)
error-message: Use imperative mood (i.e write "Fix", not "Fixed" or "Fixing")
Expand Down
2 changes: 2 additions & 0 deletions lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
# Match regex title with the title
if grep -qP -- "$TITLE_REGEX" <<< "$TITLE"; then
echo "Title matches regex: $TITLE_REGEX"
echo "verdict=Passed" >> "$GITHUB_OUTPUT"
else
echo "Title does not match regex: $TITLE_REGEX" >&2
echo "::error title=PR Title is invalid::$ERROR_MESSAGE"
echo "verdict=$ERROR_MESSAGE" >> "$GITHUB_OUTPUT"
exit 1
fi

0 comments on commit 9e8e67a

Please sign in to comment.