Skip to content

Commit c209151

Browse files
authored
Actions: attempt to validate PR description tests
Stolen from https://github.com/orgs/community/discussions/84771#discussioncomment-8039595
1 parent 1273b1c commit c209151

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: PR Description Validator
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, reopened]
6+
7+
jobs:
8+
validate-pr-description:
9+
name: Validate PR Description
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Set up workspace
13+
uses: actions/checkout@v2
14+
15+
- name: Validate PR Description
16+
run: |
17+
# Ensure jq is installed
18+
sudo apt-get install jq
19+
20+
# Fetch PR description using jq
21+
PR_DESCRIPTION=$(jq -r ".pull_request.body" "$GITHUB_EVENT_PATH")
22+
KEYWORD="REQUIRED_KEYWORD"
23+
24+
# Check for the required keyword in the PR description
25+
if [[ $PR_DESCRIPTION = *"<!--"* ]] || [[ $PR_DESCRIPTION = *"-->"* ]]; then
26+
echo "Please remove the welcome comment from your PR description."
27+
exit 1
28+
fi

0 commit comments

Comments
 (0)