Skip to content

CI: Merge branch main into BIPS-18112-oss-fuzz #19

CI: Merge branch main into BIPS-18112-oss-fuzz

CI: Merge branch main into BIPS-18112-oss-fuzz #19

name: Validate PR Template
on:
pull_request:
types: [opened, edited, reopened]
jobs:
validate-pr:
runs-on: ubuntu-latest
<<<<<<< HEAD

Check failure on line 10 in .github/workflows/validate-pr-template.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/validate-pr-template.yml

Invalid workflow file

You have an error in your yaml syntax on line 10
=======
if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'beyondtrust-release-app[bot]' }}
>>>>>>> main
steps:
- name: Check PR Description
id: validate
run: |
PR_BODY=$(jq -r '.pull_request.body' "$GITHUB_EVENT_PATH")
if [[ -z "$PR_BODY" || "$PR_BODY" == "null" ]]; then
echo "PR description is empty or null."
exit 1
fi
# Check sections
PURPOSE=$(echo "$PR_BODY" | sed -n '/### Purpose of the PR/,/### According to ticket/p' | sed '1d;$d' | grep -v "<!--")
TICKET=$(echo "$PR_BODY" | sed -n '/### According to ticket/,/### Summary of changes:/p' | sed '1d;$d' | grep -v "<!--")
SUMMARY=$(echo "$PR_BODY" | sed -n '/### Summary of changes:/,$p' | sed '1d' | grep -v "<!--")
# Validate each section
if [[ -z "$PURPOSE" || "$PURPOSE" =~ ^[[:space:]]*$ ]]; then
echo "The 'Purpose of the PR' section must contain meaningful text below the placeholder."
exit 1
fi
if [[ -z "$TICKET" || "$TICKET" =~ ^[[:space:]]*$ ]]; then
echo "The 'According to ticket' section must contain meaningful text (e.g., Jira URL or ticket number)."
exit 1
fi
if [[ -z "$SUMMARY" || "$SUMMARY" =~ ^[[:space:]]*$ ]]; then
echo "The 'Summary of changes' section must contain meaningful text below the placeholder."
exit 1
fi
echo "PR description is valid."
- name: Set output for success
if: success()
run: echo "PR template validation passed!"