Skip to content

Instantly share code, notes, and snippets.

@vilmibm
Created April 12, 2021 20:13
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vilmibm/fd84ae64bce45f07004487f9de38d57f to your computer and use it in GitHub Desktop.
Save vilmibm/fd84ae64bce45f07004487f9de38d57f to your computer and use it in GitHub Desktop.
name: Pull Request Check
on:
workflow_dispatch:
inputs:
body:
default: ""
test:
default: "false"
pull_request_target:
jobs:
check-body-length:
runs-on: ubuntu-latest
steps:
- name: check
env:
PRNUM: ${{ github.event.pull_request.number }}
PRBODY: ${{ github.event.pull_request.body }}
TESTBODY: ${{ github.event.inputs.body }}
TEST: ${{ github.event.inputs.test }}
run: |
if [ "$TEST" = "true" ]
then
PRBODY=$TESTBODY
fi
commentPR () {
if [ "$TEST" = "true" ]
then
echo "would comment: '${1}'"
else
gh pr comment $PRNUM -b "${1}"
fi
}
if [ "$PRBODY" = "" ]
then
commentPR "Thanks! Please add a 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