-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added `branch.name.validation.yml Added pre-commit hook with wpcs-check
- Loading branch information
Showing
6 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Branch Name Validation | ||
|
||
on: | ||
create: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
branch_name_validation: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check Branch Name | ||
id: check_branch | ||
run: | | ||
branch_name="${GITHUB_REF#refs/heads/}" | ||
if ! [[ "$branch_name" =~ ^(main|(release/[0-9]+\.[0-9]+\.[0-9]+)|(issue/[0-9]+)|(suggestion/[0-9]+)|(feature/[a-z0-9\-]+)|(dev/[a-z0-9\-]+))$ ]]; then | ||
echo "Invalid branch name: $branch_name" | ||
exit 1 | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
# Check if there are modified or newly created .php files | ||
if git status --porcelain | grep -e '^M' -e '^A' | grep '\.php$' &> /dev/null; then | ||
composer cs | ||
else | ||
exit 0 | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
while read local_ref local_sha remote_ref remote_sha; do | ||
# Extracting the branch name | ||
branch_name=$(echo "$local_ref" | cut -d '/' -f 3-) | ||
|
||
# Check if the branch name matches any of the specified patterns | ||
# shellcheck disable=SC2039 | ||
if ! [[ "$branch_name" =~ ^(main|(release/[0-9]+\.[0-9]+\.[0-9]+)|(issue/[0-9]+)|(suggestion/[0-9]+)|(feature/[a-z0-9\-]+)|(dev/[a-z0-9\-]+))$ ]]; then | ||
echo "Error: Branch name \"$branch_name\" is not allowed." | ||
exit 1 | ||
fi | ||
done |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"name": "jetformbuilder", | ||
"version": "3.2.0", | ||
"description": "wordpress-plugin", | ||
"directories": { | ||
"test": "tests" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Crocoblock/jetformbuilder.git" | ||
}, | ||
"keywords": [ | ||
"plugin", | ||
"wordpress", | ||
"form", | ||
"builder" | ||
], | ||
"author": "Oleksandr Ivanenko <[email protected]>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/Crocoblock/jetformbuilder/issues" | ||
}, | ||
"homepage": "https://github.com/Crocoblock/jetformbuilder#readme", | ||
"devDependencies": { | ||
"husky": "^8.0.3" | ||
}, | ||
"scripts": { | ||
"postinstall": "npx husky install" | ||
} | ||
} |