From 3364c100da1c5f13a50f6ce559ef17be6f1cdf9f Mon Sep 17 00:00:00 2001 From: Calvin Cestari Date: Wed, 20 Mar 2024 15:15:12 -0700 Subject: [PATCH] Add GH action to check PR metadata (apollographql/apollo-ios-dev#303) --- .github/workflows/check-pr-metadata.yml | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/check-pr-metadata.yml diff --git a/.github/workflows/check-pr-metadata.yml b/.github/workflows/check-pr-metadata.yml new file mode 100644 index 000000000..3762b4676 --- /dev/null +++ b/.github/workflows/check-pr-metadata.yml @@ -0,0 +1,26 @@ +name: Check PR Metadata + +on: + pull_request: + types: [ready_for_review, opened] + +jobs: + check-pr-metadata: + permissions: + pull-requests: write + runs-on: ubuntu-latest + steps: + - run: | + if ! [[ -z "${BODY// }" ]] || [ "$DRAFT" = true ]; then + echo "PR is draft or description has length, skipping comment." + else + gh pr comment "$NUMBER" --body "$MESSAGE" + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + NUMBER: ${{ github.event.pull_request.number }} + DRAFT: ${{ github.event.pull_request.draft }} + BODY: ${{ github.event.pull_request.body }} + MESSAGE: > + It looks like you didn't add a description to your pull request. Please edit and add as much detail as possible for the reviewers. Pull requests require a description before they will be reviewed - thank you.