DO NOT MERGE New target contracts v2 #556
This file contains hidden or 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: Enforce Pull Request Name | |
on: | |
pull_request: | |
types: [opened, edited, synchronize] | |
jobs: | |
enforce_pr_name: | |
runs-on: "k8s-native" | |
container: | |
image: "ubuntu:24.04" | |
steps: | |
- name: Enforce PR name | |
shell: bash | |
run: | | |
pr_title="${{ github.event.pull_request.title }}" | |
echo "Pull Request Title: $pr_title" | |
# Define a regex pattern for the expected PR title format | |
regular_branch_pattern='^(DEV|Dev)-([0-9]{3,}).*$' | |
hotfix_branch_pattern='^HF.*$' | |
release_candidate_branch_pattern='^RC.*$' | |
if [[ ! "$pr_title" =~ $regular_branch_pattern && ! "$pr_title" =~ $hotfix_branch_pattern && ! "$pr_title" =~ $release_candidate_branch_pattern ]]; then | |
echo "Error: PR title does not match the required format 'DEV-[ddd]' or 'HF' or 'RC'." | |
exit 1 | |
fi | |
echo "PR title is correct." |