PR-63: Outliers identifier #138
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 format | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- edited | |
- reopened | |
jobs: | |
validate-pr-format: | |
name: Title and description | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check if it's a Dependabot PR | |
id: dependabot-check | |
run: | | |
if [[ "${{ github.event.pull_request.user.login }}" == "dependabot[bot]" ]]; then | |
echo "info: Skipping validation for Dependabot PR." | |
echo "::set-output name=skip_validation::true" | |
else | |
echo "::set-output name=skip_validation::false" | |
fi | |
- name: Check PR title format | |
if: steps.dependabot-check.outputs.skip_validation != 'true' | |
run: | | |
PR_TITLE_REGEX="^PR-[0-9]+: .+" | |
if [[ ! "${{ github.event.pull_request.title }}" =~ $PR_TITLE_REGEX ]]; then | |
echo "error: Invalid PR title format. Please use 'PR-XXX: Your title'." | |
exit 1 | |
fi | |
- name: Check PR description format | |
if: steps.dependabot-check.outputs.skip_validation != 'true' | |
run: | | |
# Check if the description contains a list of changes (e.g., using '* ' to indicate list items) | |
if ! grep -q '^\s*\*\s' <<< "${{ github.event.pull_request.body }}"; then | |
echo "error: PR description should contain a list of changes." | |
exit 1 | |
fi |