Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

verify description contains tests performed #8

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/pr-description-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Check PR Description contains tests performed

on:
pull_request:
types: [opened, edited, reopened, synchronize]

jobs:
check-pr-description:
runs-on: ubuntu-latest

steps:
- name: Check out the code
uses: actions/checkout@v2

- name: Validate PR description
id: validate
run: |
if [[ ! "${{ github.event.pull_request.body }}" =~ "## Tests performed" ]]; then
echo "PR description does not contain the section 'Tests performed'."
exit 1
fi

# Extract the "Tests performed" section
tests_performed_section=$(sed -n '/## Tests performed/,/##/p' <<< "${{ github.event.pull_request.body }}")

# Check if there is at least one test description in the "Tests performed" section
if [[ ! "$tests_performed_section" =~ "- " ]]; then
echo "The 'Tests performed' section does not contain a list of tests."
exit 1
fi

- name: Success message
if: success()
run: echo "PR description contains the 'Tests performed' section with a list of tests."
Loading