From dd201077ddca9466f427a88dd6f2a7c95832bc04 Mon Sep 17 00:00:00 2001 From: Michael Frikke Depner Date: Mon, 28 Aug 2023 12:55:24 +0200 Subject: [PATCH] Add PR validation workflow --- .github/workflows/pr-validation.yml | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/pr-validation.yml diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml new file mode 100644 index 00000000..990f09a9 --- /dev/null +++ b/.github/workflows/pr-validation.yml @@ -0,0 +1,34 @@ +name: "PR Tasks Completed Check" +on: + pull_request: + types: opened + +jobs: + task-check: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - name: Comment if checkmark is missing + if: ${{ !contains(github.event.pull_request.body, '[X] I acknowledge') }} + uses: actions/github-script@v6 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: "Please don't submit a PR containing Kata solutions. If you are adding an improvement to the Katas repo, please resubmit this PR and check the `[X]` box in the PR template." + }) + - name: Close PR if checkmark is missing + if: ${{ !contains(github.event.pull_request.body, '[X] I acknowledge') }} + uses: actions/github-script@v6 + with: + script: | + github.rest.pulls.update({ + pull_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + state: 'closed' + })