From 0f3ff3846a7d1a158eec1eb930e15ef90978a379 Mon Sep 17 00:00:00 2001 From: sarahCx Date: Tue, 24 Sep 2024 12:34:02 +0300 Subject: [PATCH] PR linter (AST-37686) (#880) * check requirement * Add other --------- Co-authored-by: AlvoBen <144705560+AlvoBen@users.noreply.github.com> --- .github/workflows/pr-linter.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/pr-linter.yml diff --git a/.github/workflows/pr-linter.yml b/.github/workflows/pr-linter.yml new file mode 100644 index 000000000..01aa69cae --- /dev/null +++ b/.github/workflows/pr-linter.yml @@ -0,0 +1,31 @@ +name: PR Linter + +on: + pull_request: + types: [opened, edited] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Check PR Title and Branch + run: | + PR_TITLE="${{ github.event.pull_request.title }}" + PR_BRANCH="${{ github.head_ref }}" + + if ! [[ "$PR_TITLE" =~ ^[A-Z][a-zA-Z0-9]* ]]; then + echo "::error::PR title must be in CamelCase. Please update the title." + exit 1 + fi + + if ! [[ "$PR_TITLE" =~ \(AST-[0-9]+\)$ ]]; then + echo "::error::PR title must contain a Jira ticket ID at the end in the format '(AST-XXXX)'." + exit 1 + fi + + if ! [[ "$PR_BRANCH" =~ ^(bug|feature|other)/ ]]; then + echo "::error::Branch name must start with 'bug/' or 'feature/' or 'other/'." + exit 1 + fi + + shell: bash \ No newline at end of file