diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 7ba77181b..1601bc7e3 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -27,7 +27,7 @@ ## Checklist *Do not delete any line. Leave **unfinished** elements unchecked so others know how far along you are.\ -In the end all checkboxes must be ticked before you can merge*. +In the end all checkboxes must be ticked before you can merge*. (You may skip this list if only .md files are changed.) - [ ] **I executed the automated model tests (`make test`) after my final commit and all tests pass (`FAIL 0`)** - [ ] **I adjusted the reporting in [`remind2`](https://github.com/pik-piam/remind2) if and where it was needed** diff --git a/.github/workflows/check-pr-description-code.yaml b/.github/workflows/check-pr-description-code.yaml new file mode 100644 index 000000000..82a9d74ac --- /dev/null +++ b/.github/workflows/check-pr-description-code.yaml @@ -0,0 +1,34 @@ +on: + pull_request: + types: [opened, reopened, edited, ready_for_review] + branches-ignore: + - 'master' + paths-ignore: + - '**.md' + +name: check-pr-checklist + +jobs: + check-pr-checklist: + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + steps: + - name: Check PR Checklist + env: + PR_DESCRIPTION: ${{ github.event.pull_request.body }} + run: | + ERROR_FOUND=0 + + # Check 1: All checkboxes in "Checklist" must be checked + CHECKLIST_SECTION=$(echo "$PR_DESCRIPTION" | sed -n '/## Checklist/,/## Further information (optional)/p') + if echo "$CHECKLIST_SECTION" | grep -q "\[ \]"; then + echo "ERROR: Unchecked checkboxes found in 'Checklist' section." + echo "All checklist items must be checked before merging." + ERROR_FOUND=1 + fi + + if [ $ERROR_FOUND -eq 1 ]; then + exit 1 + fi + + echo "Success: All PR template requirements are fulfilled." diff --git a/.github/workflows/check-pr-description.yaml b/.github/workflows/check-pr-description.yaml index bf2735beb..8178492ed 100644 --- a/.github/workflows/check-pr-description.yaml +++ b/.github/workflows/check-pr-description.yaml @@ -3,13 +3,17 @@ on: types: [opened, reopened, edited, ready_for_review] branches-ignore: - 'master' + paths-ignore: + - '**.md' + +name: check-pr-description jobs: - check-pr-template: + check-pr-code-tasks: if: github.event.pull_request.draft == false runs-on: ubuntu-latest steps: - - name: Check PR description + - name: Check PR Description env: PR_DESCRIPTION: ${{ github.event.pull_request.body }} run: | @@ -31,16 +35,8 @@ jobs: ERROR_FOUND=1 fi - # Check 3: All checkboxes in "Checklist" must be checked - CHECKLIST_SECTION=$(echo "$PR_DESCRIPTION" | sed -n '/## Checklist/,/## Further information (optional)/p') - if echo "$CHECKLIST_SECTION" | grep -q "\[ \]"; then - echo "ERROR: Unchecked checkboxes found in 'Checklist' section." - echo "All checklist items must be checked before merging." - ERROR_FOUND=1 - fi - if [ $ERROR_FOUND -eq 1 ]; then exit 1 fi - echo "Success: All PR template requirements are fulfilled." \ No newline at end of file + echo "Success: All PR template requirements are fulfilled."