Skip to content

Instantly share code, notes, and snippets.

@vilmibm

vilmibm/pr-check.yml

Created Apr 12, 2021
Embed
What would you like to do?
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