chore(main): release 0.14.1 #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Validate PR Template | |
on: | |
pull_request: | |
types: [opened, edited, reopened] | |
jobs: | |
validate-pr: | |
runs-on: ubuntu-latest | |
if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'beyondtrust-release-app[bot]' }} | |
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!" |