Skip to content

Instantly share code, notes, and snippets.

@vilmibm
Last active April 9, 2021 22:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vilmibm/d793797b20178d795460e40dc46c52d5 to your computer and use it in GitHub Desktop.
Save vilmibm/d793797b20178d795460e40dc46c52d5 to your computer and use it in GitHub Desktop.
name: Pull Request Check
on: pull_request
# We'll keep this around for testing in the future
#on:
# workflow_dispatch:
# inputs:
# pull_request_body:
# default: ""
# pull_request_number:
# default: "123"
jobs:
check-body-length:
runs-on: ubuntu-latest
steps:
- name: check
env:
PRNUM: ${{ github.event.pull_request.number }}
PRBODY: ${{ github.event.pull_request.body }}
#PRNUM: ${{ github.event.inputs.pull_request_number }}
#PRBODY: ${{ github.event.inputs.pull_request_body }}
#TEST: "true"
run: |
commentPR () {
if [ "$TEST" = "true" ]
then
echo "gh pr comment $PRNUM -b '${1}'"
else
gh pr comment $PRNUM -b "${1}"
fi
}
if [ $(wc -c <<<"$PRBODY") -lt 10 ]
then
commentPR "Thanks! Please add more context to the PR body so we can better review your contribution."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment