mirror of
https://github.com/amd/blis.git
synced 2026-04-19 15:18:52 +00:00
SWLDEVOPS-7853 - Action file to mandate branch naming convention (#2)
SWLDEVOPS-7853 - Action file to mandate branch naming convention --------- Co-authored-by: vkallesh <vkallesh@amd.com>
This commit is contained in:
committed by
GitHub
parent
42a0d74ced
commit
a2a045cb2e
30
.github/workflows/branch-name-check.yml
vendored
Normal file
30
.github/workflows/branch-name-check.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
name: Branch Name Check
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
jobs:
|
||||
check_branch_name:
|
||||
runs-on: Linux # Use the default GitHub-hosted runner with Linux
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Check branch name using Bash
|
||||
env:
|
||||
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
|
||||
USER: ${{ github.actor }}
|
||||
run: |
|
||||
echo "Original USER: $USER"
|
||||
BASE_USER=${USER%_amdeng} # Trim the trailing _amdeng from the USER
|
||||
echo "Trimmed USER: $BASE_USER"
|
||||
|
||||
echo "Checking branch name: $BRANCH_NAME"
|
||||
if [[ ! "$BRANCH_NAME" =~ ^u/.*/PR/.*$ ]] && [[ ! "$BRANCH_NAME" =~ ^u/.*/WIP/.*$ ]]; then
|
||||
echo "Error: Branch name '$BRANCH_NAME' does not match the required naming convention 'u/$BASE_USER/PR-*' or 'u/$BASE_USER/WIP-*'."
|
||||
exit 1
|
||||
fi
|
||||
echo "Branch name '$BRANCH_NAME' is valid."
|
||||
shell: bash # Use the default Linux shell
|
||||
Reference in New Issue
Block a user