Skip to content

Commit

Permalink
Fix the "Pull Request Checks" workflow (#109)
Browse files Browse the repository at this point in the history
The current implementation fails if the PR description contains
quotes. This commit uses 'gsactions/commit-message-checker' for
verification.

Resolves: AlmaLinux/build-system/issues/286
  • Loading branch information
isudak committed May 22, 2024
1 parent 2aedc34 commit ac6c9aa
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,16 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Check the PR title and description
run: |
errors=
- name: Check the PR title
uses: gsactions/commit-message-checker@v2
with:
pattern: '^.{1,72}$'
excludeTitle: 'false'
excludeDescription: 'true'
error: 'The maximum line length of 72 characters is exceeded.'

if grep -qE '^.{73,}$' <<< "${{ github.event.pull_request.title }}"; then
printf "ERROR: The PR title is longer than 72 characters:\n"
printf " > ${{ github.event.pull_request.title }}\n"
errors=true
fi
issue_regex='(Resolves|Fixes):? +(https:\/\/github.com\/)?AlmaLinux\/build-system(\/issues\/|#)[0-9]+'
if ! grep -qE "$issue_regex" <<< "${{ github.event.pull_request.body }}"; then
printf "ERROR: You need at least one \"Resolves|Fixes: <issue link>\" line.\n"
errors=true
fi
if [[ $errors == true ]]; then
exit 2
fi
- name: Check the PR description
uses: gsactions/commit-message-checker@v2
with:
pattern: '(Resolves|Fixes):? +(https:\/\/github.com\/)?AlmaLinux\/build-system(\/issues\/|#)[0-9]+'
error: 'You need at least one "Resolves|Fixes: <issue link>" line.'

0 comments on commit ac6c9aa

Please sign in to comment.