Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Commit 487e310

Browse files
authored
verify description contains tests performed (#6)
1 parent 28f0358 commit 487e310

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Check PR Description contains tests performed
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, reopened, synchronize]
6+
7+
jobs:
8+
check-pr-description:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Check out the code
13+
uses: actions/checkout@v2
14+
15+
- name: Validate PR description
16+
id: validate
17+
run: |
18+
if [[ ! "${{ github.event.pull_request.body }}" =~ "## Tests performed" ]]; then
19+
echo "PR description does not contain the section 'Tests performed'."
20+
exit 1
21+
fi
22+
23+
# Extract the "Tests performed" section
24+
tests_performed_section=$(sed -n '/## Tests performed/,/##/p' <<< "${{ github.event.pull_request.body }}")
25+
26+
# Check if there is at least one test description in the "Tests performed" section
27+
if [[ ! "$tests_performed_section" =~ "- " ]]; then
28+
echo "The 'Tests performed' section does not contain a list of tests."
29+
exit 1
30+
fi
31+
32+
- name: Success message
33+
if: success()
34+
run: echo "PR description contains the 'Tests performed' section with a list of tests."

0 commit comments

Comments
 (0)