From 36b21a7fac80e17e17743dfabf50ae01f17c42a6 Mon Sep 17 00:00:00 2001 From: youssefmdev22 Date: Tue, 2 Sep 2025 11:37:52 +0300 Subject: [PATCH 01/17] test --- .../workflows/branch_name_check_action.yaml | 30 ++ .github/workflows/dart_linting_action.yaml | 22 ++ .github/workflows/pr_title_check_action.yaml | 33 ++ .../workflows/unit_testing_check_action.yaml | 7 +- pubspec.lock | 328 ++++++++++++++++++ pubspec.yaml | 1 + 6 files changed, 415 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/branch_name_check_action.yaml create mode 100644 .github/workflows/dart_linting_action.yaml create mode 100644 .github/workflows/pr_title_check_action.yaml diff --git a/.github/workflows/branch_name_check_action.yaml b/.github/workflows/branch_name_check_action.yaml new file mode 100644 index 0000000..90d28b7 --- /dev/null +++ b/.github/workflows/branch_name_check_action.yaml @@ -0,0 +1,30 @@ +## name of your github action +name: Branch Name Action + +## when will the action trigger +on: + pull_request: + types: + - opened + - edited + - synchronize + - reopened + +## the action script +jobs: + validate-branch-name: + runs-on: ubuntu-latest + steps: + - name: Validate Branch Name + run: | + BRANCH_NAME="${{ github.head_ref }}" + echo "Branch name: $BRANCH_NAME" + + if [[ ! "$BRANCH_NAME" =~ ^(feature|bugfix|hotfix|release)\/ECOM-[0-9]+\/[A-Za-z0-9 _-]+$ ]]; then + echo "Invalid branch name format: $BRANCH_NAME" + echo "Required format: /ECOM-/" + echo "Example: feature/ECOM-27/Initialize Project" + exit 1 + fi + + echo "Valid branch name" \ No newline at end of file diff --git a/.github/workflows/dart_linting_action.yaml b/.github/workflows/dart_linting_action.yaml new file mode 100644 index 0000000..60f680d --- /dev/null +++ b/.github/workflows/dart_linting_action.yaml @@ -0,0 +1,22 @@ +## name of your github action +name: Dart Linting Action + +## when will the action trigger +on: + pull_request: + push: + +## the action script +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Clone repository + uses: actions/checkout@v4 + - name: Set up Dart + uses: dart-lang/setup-dart@v1 + - run: dart --version + - name: Install packages + run: dart pub get + - name: Run Dart Analyzer + run: dart analyze \ No newline at end of file diff --git a/.github/workflows/pr_title_check_action.yaml b/.github/workflows/pr_title_check_action.yaml new file mode 100644 index 0000000..1072c5d --- /dev/null +++ b/.github/workflows/pr_title_check_action.yaml @@ -0,0 +1,33 @@ +## name of your github action +name: PR Title Action + +## when will the action trigger +on: + pull_request_target: + types: + - opened + - edited + - synchronize + - reopened + +## the action script +jobs: + pr_title: + runs-on: ubuntu-latest + steps: + - name: Check PR Title + env: + PR_TITLE: ${{ github.event.pull_request.title }} + run: | + echo "Validating PR title: $PR_TITLE" + + if [[ ! "$PR_TITLE" =~ ^(fix|release|feat|hotfix|build|test)\((ECOM-[0-9]+|JIRA-[0-9]+)\):\s.+$ ]]; then + echo "Invalid PR title format: '$PR_TITLE'" + echo "Required format: (): task name" + echo "Allowed types: fix, release, feat, hotfix, build, test" + echo "Allowed scopes: ECOM-, JIRA-" + echo "Example: feat(ECOM-27): Add login screen" + exit 1 + fi + + echo "PR title format is valid!" \ No newline at end of file diff --git a/.github/workflows/unit_testing_check_action.yaml b/.github/workflows/unit_testing_check_action.yaml index 0c21e74..4a26da0 100644 --- a/.github/workflows/unit_testing_check_action.yaml +++ b/.github/workflows/unit_testing_check_action.yaml @@ -5,15 +5,10 @@ name: Flutter Unit Testing Action on: pull_request: push: - branches: - - main - - development - - release/* - - feature/* ## the action script jobs: - main: + test: runs-on: ubuntu-latest steps: - name: Clone repository diff --git a/pubspec.lock b/pubspec.lock index eaa659f..d4bc197 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,30 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: f0bb5d1648339c8308cc0b9838d8456b3cfe5c91f9dc1a735b4d003269e5da9a + url: "https://pub.dev" + source: hosted + version: "88.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "0b7b9c329d2879f8f05d6c05b32ee9ec025f39b077864bdb5ac9a7b63418a98f" + url: "https://pub.dev" + source: hosted + version: "8.1.1" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" async: dependency: transitive description: @@ -17,6 +41,70 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" + build: + dependency: transitive + description: + name: build + sha256: "6439a9c71a4e6eca8d9490c1b380a25b02675aa688137dfbe66d2062884a23ac" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + build_config: + dependency: transitive + description: + name: build_config + sha256: "4f64382b97504dc2fcdf487d5aae33418e08b4703fc21249e4db6d804a4d0187" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: "8e928697a82be082206edb0b9c99c5a4ad6bc31c9e9b8b2f291ae65cd4a25daa" + url: "https://pub.dev" + source: hosted + version: "4.0.4" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: "2b21a125d66a86b9511cc3fb6c668c42e9a1185083922bf60e46d483a81a9712" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + build_runner: + dependency: "direct main" + description: + name: build_runner + sha256: fd3c09f4bbff7fa6e8d8ef688a0b2e8a6384e6483a25af0dac75fef362bcfe6f + url: "https://pub.dev" + source: hosted + version: "2.7.0" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: ab27e46c8aa233e610cf6084ee6d8a22c6f873a0a9929241d8855b7a72978ae7 + url: "https://pub.dev" + source: hosted + version: "9.3.0" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: ba95c961bafcd8686d1cf63be864eb59447e795e124d98d6a27d91fcd13602fb + url: "https://pub.dev" + source: hosted + version: "8.11.1" characters: dependency: transitive description: @@ -25,6 +113,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.4.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: "959525d3162f249993882720d52b7e0c833978df229be20702b33d48d91de70f" + url: "https://pub.dev" + source: hosted + version: "2.0.4" clock: dependency: transitive description: @@ -33,6 +129,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.2" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: "0ec10bf4a89e4c613960bf1e8b42c64127021740fb21640c29c909826a5eea3e" + url: "https://pub.dev" + source: hosted + version: "4.10.1" collection: dependency: transitive description: @@ -41,6 +145,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.19.1" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + crypto: + dependency: transitive + description: + name: crypto + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + url: "https://pub.dev" + source: hosted + version: "3.0.6" cupertino_icons: dependency: "direct main" description: @@ -49,6 +169,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.8" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: c87dfe3d56f183ffe9106a18aebc6db431fc7c98c31a54b952a77f3d54a85697 + url: "https://pub.dev" + source: hosted + version: "3.1.2" fake_async: dependency: transitive description: @@ -57,6 +185,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.3" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" flutter: dependency: "direct main" description: flutter @@ -75,6 +219,62 @@ packages: description: flutter source: sdk version: "0.0.0" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + url: "https://pub.dev" + source: hosted + version: "4.0.0" + glob: + dependency: transitive + description: + name: glob + sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de + url: "https://pub.dev" + source: hosted + version: "2.1.3" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 + url: "https://pub.dev" + source: hosted + version: "3.2.2" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + io: + dependency: transitive + description: + name: io + sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b + url: "https://pub.dev" + source: hosted + version: "1.0.5" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" leak_tracker: dependency: transitive description: @@ -107,6 +307,14 @@ packages: url: "https://pub.dev" source: hosted version: "5.1.1" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" matcher: dependency: transitive description: @@ -131,6 +339,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.16.0" + mime: + dependency: transitive + description: + name: mime + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc + url: "https://pub.dev" + source: hosted + version: "2.2.0" path: dependency: transitive description: @@ -139,6 +363,46 @@ packages: url: "https://pub.dev" source: hosted version: "1.9.1" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: "0560ba233314abbed0a48a2956f7f022cce7c3e1e73df540277da7544cad4082" + url: "https://pub.dev" + source: hosted + version: "1.5.0" + shelf: + dependency: transitive + description: + name: shelf + sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 + url: "https://pub.dev" + source: hosted + version: "1.4.2" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925" + url: "https://pub.dev" + source: hosted + version: "3.0.0" sky_engine: dependency: transitive description: flutter @@ -168,6 +432,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 + url: "https://pub.dev" + source: hosted + version: "2.1.1" string_scanner: dependency: transitive description: @@ -192,6 +464,22 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.4" + timing: + dependency: transitive + description: + name: timing + sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" vector_math: dependency: transitive description: @@ -208,6 +496,46 @@ packages: url: "https://pub.dev" source: hosted version: "15.0.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "5bf046f41320ac97a469d506261797f35254fa61c641741ef32dacda98b7d39c" + url: "https://pub.dev" + source: hosted + version: "1.1.3" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8 + url: "https://pub.dev" + source: hosted + version: "3.0.3" + yaml: + dependency: transitive + description: + name: yaml + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce + url: "https://pub.dev" + source: hosted + version: "3.1.3" sdks: dart: ">=3.8.1 <4.0.0" flutter: ">=3.18.0-18.0.pre.54" diff --git a/pubspec.yaml b/pubspec.yaml index d66383e..9fed257 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -34,6 +34,7 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.8 + build_runner: ^2.7.0 dev_dependencies: flutter_test: From 94ffb76b3a89f9ff7e07ccada0df69be1426f488 Mon Sep 17 00:00:00 2001 From: youssefmdev22 Date: Tue, 2 Sep 2025 11:42:53 +0300 Subject: [PATCH 02/17] test --- pubspec.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 9fed257..d78f367 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -34,7 +34,7 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.8 - build_runner: ^2.7.0 + json_annotation: ^4.9.0 dev_dependencies: flutter_test: @@ -46,6 +46,8 @@ dev_dependencies: # package. See that file for information about deactivating specific lint # rules and activating additional ones. flutter_lints: ^5.0.0 + build_runner: ^2.7.0 + json_serializable: ^6.10.0 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec From 7d99a0c6a50aea7c145de83ebbc07b6ed4b5010f Mon Sep 17 00:00:00 2001 From: youssefmdev22 Date: Tue, 2 Sep 2025 11:50:48 +0300 Subject: [PATCH 03/17] test --- .github/workflows/dart_linting_action.yaml | 24 ++++++++++++------- .github/workflows/pr_title_check_action.yaml | 2 +- .../workflows/unit_testing_check_action.yaml | 6 ++++- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/.github/workflows/dart_linting_action.yaml b/.github/workflows/dart_linting_action.yaml index 60f680d..478ac02 100644 --- a/.github/workflows/dart_linting_action.yaml +++ b/.github/workflows/dart_linting_action.yaml @@ -4,7 +4,11 @@ name: Dart Linting Action ## when will the action trigger on: pull_request: - push: + types: + - opened + - edited + - synchronize + - reopened ## the action script jobs: @@ -13,10 +17,14 @@ jobs: steps: - name: Clone repository uses: actions/checkout@v4 - - name: Set up Dart - uses: dart-lang/setup-dart@v1 - - run: dart --version - - name: Install packages - run: dart pub get - - name: Run Dart Analyzer - run: dart analyze \ No newline at end of file + + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + channel: stable + flutter-version: 3.35.2 + + - name: Run Dart Package Analyzer + uses: axel-op/dart-package-analyzer@v3 + with: + githubToken: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/pr_title_check_action.yaml b/.github/workflows/pr_title_check_action.yaml index 1072c5d..e1bf304 100644 --- a/.github/workflows/pr_title_check_action.yaml +++ b/.github/workflows/pr_title_check_action.yaml @@ -3,7 +3,7 @@ name: PR Title Action ## when will the action trigger on: - pull_request_target: + pull_request: types: - opened - edited diff --git a/.github/workflows/unit_testing_check_action.yaml b/.github/workflows/unit_testing_check_action.yaml index 4a26da0..2e40592 100644 --- a/.github/workflows/unit_testing_check_action.yaml +++ b/.github/workflows/unit_testing_check_action.yaml @@ -4,7 +4,11 @@ name: Flutter Unit Testing Action ## when will the action trigger on: pull_request: - push: + types: + - opened + - edited + - synchronize + - reopened ## the action script jobs: From 566a6cc8a505b8862304e214d16913bcfc461c3c Mon Sep 17 00:00:00 2001 From: youssefmdev22 Date: Tue, 2 Sep 2025 12:06:27 +0300 Subject: [PATCH 04/17] test --- .github/workflows/branch_name_check_action.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/branch_name_check_action.yaml b/.github/workflows/branch_name_check_action.yaml index 90d28b7..1ef2a8f 100644 --- a/.github/workflows/branch_name_check_action.yaml +++ b/.github/workflows/branch_name_check_action.yaml @@ -16,8 +16,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Validate Branch Name + env: + BRANCH_NAME: ${{ github.head_ref }} run: | - BRANCH_NAME="${{ github.head_ref }}" echo "Branch name: $BRANCH_NAME" if [[ ! "$BRANCH_NAME" =~ ^(feature|bugfix|hotfix|release)\/ECOM-[0-9]+\/[A-Za-z0-9 _-]+$ ]]; then From b27ac5fb26651bf98d8ffab1d0d60e5782860c54 Mon Sep 17 00:00:00 2001 From: youssefmdev22 Date: Tue, 2 Sep 2025 12:10:11 +0300 Subject: [PATCH 05/17] test --- .github/workflows/branch_name_check_action.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/branch_name_check_action.yaml b/.github/workflows/branch_name_check_action.yaml index 1ef2a8f..61de339 100644 --- a/.github/workflows/branch_name_check_action.yaml +++ b/.github/workflows/branch_name_check_action.yaml @@ -16,9 +16,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Validate Branch Name - env: - BRANCH_NAME: ${{ github.head_ref }} + shell: bash run: | + BRANCH_NAME="${{ github.head_ref }}" echo "Branch name: $BRANCH_NAME" if [[ ! "$BRANCH_NAME" =~ ^(feature|bugfix|hotfix|release)\/ECOM-[0-9]+\/[A-Za-z0-9 _-]+$ ]]; then From 48ed1890bc5196b14ddbee1023c249c710d625c9 Mon Sep 17 00:00:00 2001 From: youssefmdev22 Date: Tue, 2 Sep 2025 12:11:27 +0300 Subject: [PATCH 06/17] test --- .github/workflows/pr_title_check_action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_title_check_action.yaml b/.github/workflows/pr_title_check_action.yaml index e1bf304..976bf63 100644 --- a/.github/workflows/pr_title_check_action.yaml +++ b/.github/workflows/pr_title_check_action.yaml @@ -21,7 +21,7 @@ jobs: run: | echo "Validating PR title: $PR_TITLE" - if [[ ! "$PR_TITLE" =~ ^(fix|release|feat|hotfix|build|test)\((ECOM-[0-9]+|JIRA-[0-9]+)\):\s.+$ ]]; then + if [[ ! "$PR_TITLE" =~ ^(fix|release|feat|hotfix|build|test)\((ECOM-[0-9]+|JIRA-[0-9]+)\):\s+.+$ ]]; then echo "Invalid PR title format: '$PR_TITLE'" echo "Required format: (): task name" echo "Allowed types: fix, release, feat, hotfix, build, test" From 55eaf5c01a31c841fe305bedd86439301570d992 Mon Sep 17 00:00:00 2001 From: youssefmdev22 Date: Tue, 2 Sep 2025 12:25:42 +0300 Subject: [PATCH 07/17] test --- .github/workflows/branch_name_check_action.yaml | 10 +++++++--- .github/workflows/pr_title_check_action.yaml | 8 ++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/branch_name_check_action.yaml b/.github/workflows/branch_name_check_action.yaml index 61de339..e6acd89 100644 --- a/.github/workflows/branch_name_check_action.yaml +++ b/.github/workflows/branch_name_check_action.yaml @@ -20,12 +20,16 @@ jobs: run: | BRANCH_NAME="${{ github.head_ref }}" echo "Branch name: $BRANCH_NAME" - - if [[ ! "$BRANCH_NAME" =~ ^(feature|bugfix|hotfix|release)\/ECOM-[0-9]+\/[A-Za-z0-9 _-]+$ ]]; then + + REGEX="^(feature|bugfix|hotfix|release)/ECOM-[0-9]+/[A-Za-z0-9 _-]+$" + + echo "$BRANCH_NAME" | grep -E "$REGEX" > /dev/null + + if [ $? -ne 0 ]; then echo "Invalid branch name format: $BRANCH_NAME" echo "Required format: /ECOM-/" echo "Example: feature/ECOM-27/Initialize Project" exit 1 fi - + echo "Valid branch name" \ No newline at end of file diff --git a/.github/workflows/pr_title_check_action.yaml b/.github/workflows/pr_title_check_action.yaml index 976bf63..d6e6b8c 100644 --- a/.github/workflows/pr_title_check_action.yaml +++ b/.github/workflows/pr_title_check_action.yaml @@ -21,7 +21,11 @@ jobs: run: | echo "Validating PR title: $PR_TITLE" - if [[ ! "$PR_TITLE" =~ ^(fix|release|feat|hotfix|build|test)\((ECOM-[0-9]+|JIRA-[0-9]+)\):\s+.+$ ]]; then + REGEX='^(fix|release|feat|hotfix|build|test)\((ECOM-[0-9]+|JIRA-[0-9]+)\):[[:space:]]+.+$' + + echo "$PR_TITLE" | grep -P "$REGEX" > /dev/null + + if [ $? -ne 0 ]; then echo "Invalid PR title format: '$PR_TITLE'" echo "Required format: (): task name" echo "Allowed types: fix, release, feat, hotfix, build, test" @@ -29,5 +33,5 @@ jobs: echo "Example: feat(ECOM-27): Add login screen" exit 1 fi - + echo "PR title format is valid!" \ No newline at end of file From d63344307bc288afb07b7eb024f4c0645d8fccfe Mon Sep 17 00:00:00 2001 From: youssefmdev22 Date: Tue, 2 Sep 2025 12:35:06 +0300 Subject: [PATCH 08/17] test --- .github/pr-title-checker-config.json | 27 +++++++++++++++++++ .../workflows/branch_name_check_action.yaml | 27 +++++++------------ .github/workflows/pr_title_check_action.yaml | 27 +++++-------------- 3 files changed, 42 insertions(+), 39 deletions(-) create mode 100644 .github/pr-title-checker-config.json diff --git a/.github/pr-title-checker-config.json b/.github/pr-title-checker-config.json new file mode 100644 index 0000000..7f5a922 --- /dev/null +++ b/.github/pr-title-checker-config.json @@ -0,0 +1,27 @@ +{ + "LABEL": { + "name": "title needs formatting", + "color": "EEEEEE" + }, + "CHECKS": { + "prefixes": [ + "fix: ", + "feat: ", + "hotfix: ", + "release: ", + "test: ", + "build: " + ], + "regexp": "^(fix|feat|hotfix|release|test|build)\\((ECOM|JIRA)-[0-9]+\\):\\s.+$", + "regexpFlags": "i", + "ignoreLabels": [ + "dont-check-PRs-with-this-label", + "meta" + ] + }, + "MESSAGES": { + "success": "PR title is correctly formatted.", + "failure": "PR title format is invalid. Required: (): Task name — e.g. feat(ECOM-123): Add login screen", + "notice": "Valid types: fix, feat, hotfix, release, test, build. Valid scopes: ECOM-, JIRA-" + } +} diff --git a/.github/workflows/branch_name_check_action.yaml b/.github/workflows/branch_name_check_action.yaml index e6acd89..d770387 100644 --- a/.github/workflows/branch_name_check_action.yaml +++ b/.github/workflows/branch_name_check_action.yaml @@ -15,21 +15,12 @@ jobs: validate-branch-name: runs-on: ubuntu-latest steps: - - name: Validate Branch Name - shell: bash - run: | - BRANCH_NAME="${{ github.head_ref }}" - echo "Branch name: $BRANCH_NAME" - - REGEX="^(feature|bugfix|hotfix|release)/ECOM-[0-9]+/[A-Za-z0-9 _-]+$" - - echo "$BRANCH_NAME" | grep -E "$REGEX" > /dev/null - - if [ $? -ne 0 ]; then - echo "Invalid branch name format: $BRANCH_NAME" - echo "Required format: /ECOM-/" - echo "Example: feature/ECOM-27/Initialize Project" - exit 1 - fi - - echo "Valid branch name" \ No newline at end of file + - uses: actions/checkout@v4 + + - name: Validate Branch Format + uses: KinsonDigital/BranchValidator@v1.0.0-preview.4 + with: + branch-name: "${{ github.ref }}" + trim-from-start: "refs/heads/" + validation-logic: "matches('^(feature|bugfix|hotfix|release)/ECOM-[0-9]+/[A-Za-z0-9 _-]+$')" + fail-when-not-valid: true \ No newline at end of file diff --git a/.github/workflows/pr_title_check_action.yaml b/.github/workflows/pr_title_check_action.yaml index d6e6b8c..3af559b 100644 --- a/.github/workflows/pr_title_check_action.yaml +++ b/.github/workflows/pr_title_check_action.yaml @@ -12,26 +12,11 @@ on: ## the action script jobs: - pr_title: + check: runs-on: ubuntu-latest steps: - - name: Check PR Title - env: - PR_TITLE: ${{ github.event.pull_request.title }} - run: | - echo "Validating PR title: $PR_TITLE" - - REGEX='^(fix|release|feat|hotfix|build|test)\((ECOM-[0-9]+|JIRA-[0-9]+)\):[[:space:]]+.+$' - - echo "$PR_TITLE" | grep -P "$REGEX" > /dev/null - - if [ $? -ne 0 ]; then - echo "Invalid PR title format: '$PR_TITLE'" - echo "Required format: (): task name" - echo "Allowed types: fix, release, feat, hotfix, build, test" - echo "Allowed scopes: ECOM-, JIRA-" - echo "Example: feat(ECOM-27): Add login screen" - exit 1 - fi - - echo "PR title format is valid!" \ No newline at end of file + - uses: thehanimo/pr-title-checker@v1.4.3 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + pass_on_octokit_error: false + configuration_path: .github/pr-title-checker-config.json \ No newline at end of file From 2a6e59c11059d61af4c9205ea81b9d17e5b55e70 Mon Sep 17 00:00:00 2001 From: youssefmdev22 Date: Tue, 2 Sep 2025 12:40:19 +0300 Subject: [PATCH 09/17] test --- .github/workflows/branch_name_check_action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/branch_name_check_action.yaml b/.github/workflows/branch_name_check_action.yaml index d770387..ca8a012 100644 --- a/.github/workflows/branch_name_check_action.yaml +++ b/.github/workflows/branch_name_check_action.yaml @@ -22,5 +22,5 @@ jobs: with: branch-name: "${{ github.ref }}" trim-from-start: "refs/heads/" - validation-logic: "matches('^(feature|bugfix|hotfix|release)/ECOM-[0-9]+/[A-Za-z0-9 _-]+$')" + validation-logic: matches("^(feature|bugfix|hotfix|release)/ECOM-[0-9]+/[A-Za-z0-9 _-]+$") fail-when-not-valid: true \ No newline at end of file From 7326f1d18a14b7374e2b3e4a1c29c2f03c63597a Mon Sep 17 00:00:00 2001 From: youssefmdev22 Date: Tue, 2 Sep 2025 12:49:01 +0300 Subject: [PATCH 10/17] test --- .github/workflows/branch_name_check_action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/branch_name_check_action.yaml b/.github/workflows/branch_name_check_action.yaml index ca8a012..43c5ead 100644 --- a/.github/workflows/branch_name_check_action.yaml +++ b/.github/workflows/branch_name_check_action.yaml @@ -20,7 +20,7 @@ jobs: - name: Validate Branch Format uses: KinsonDigital/BranchValidator@v1.0.0-preview.4 with: - branch-name: "${{ github.ref }}" + branch-name: "${{ github.head_ref }}" trim-from-start: "refs/heads/" validation-logic: matches("^(feature|bugfix|hotfix|release)/ECOM-[0-9]+/[A-Za-z0-9 _-]+$") fail-when-not-valid: true \ No newline at end of file From 98026c43643289c5aff167c9a9680d02cf0bc6ef Mon Sep 17 00:00:00 2001 From: youssefmdev22 Date: Tue, 2 Sep 2025 13:13:28 +0300 Subject: [PATCH 11/17] test --- .../workflows/branch_name_check_action.yaml | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/branch_name_check_action.yaml b/.github/workflows/branch_name_check_action.yaml index 43c5ead..60ac987 100644 --- a/.github/workflows/branch_name_check_action.yaml +++ b/.github/workflows/branch_name_check_action.yaml @@ -12,15 +12,20 @@ on: ## the action script jobs: - validate-branch-name: + check-branch-name: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - - name: Validate Branch Format - uses: KinsonDigital/BranchValidator@v1.0.0-preview.4 + - name: Check Branch Name + uses: actions/github-script@v6 with: - branch-name: "${{ github.head_ref }}" - trim-from-start: "refs/heads/" - validation-logic: matches("^(feature|bugfix|hotfix|release)/ECOM-[0-9]+/[A-Za-z0-9 _-]+$") - fail-when-not-valid: true \ No newline at end of file + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const core = require('@actions/core'); + const branchName = context.payload.pull_request.head.ref; + const regex = /^(feature|bugfix|hotfix|release)\/ECOM-\d+\/[\w\- ]+$/; + + if (!regex.test(branchName)) { + core.setFailed('Branch name does not match the required format: JIRA--'); + } else { + console.log('Branch name matches the required format'); + } \ No newline at end of file From e9d696009f76b0493a8894c312a5a5da8789d5d3 Mon Sep 17 00:00:00 2001 From: youssefmdev22 Date: Tue, 2 Sep 2025 13:47:25 +0300 Subject: [PATCH 12/17] test --- .../workflows/branch_name_check_action.yaml | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/branch_name_check_action.yaml b/.github/workflows/branch_name_check_action.yaml index 60ac987..4ed0826 100644 --- a/.github/workflows/branch_name_check_action.yaml +++ b/.github/workflows/branch_name_check_action.yaml @@ -12,20 +12,16 @@ on: ## the action script jobs: - check-branch-name: + Validate_Branch: + name: Validator Branch runs-on: ubuntu-latest steps: - - name: Check Branch Name - uses: actions/github-script@v6 - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - const core = require('@actions/core'); - const branchName = context.payload.pull_request.head.ref; - const regex = /^(feature|bugfix|hotfix|release)\/ECOM-\d+\/[\w\- ]+$/; + - uses: actions/checkout@v4 - if (!regex.test(branchName)) { - core.setFailed('Branch name does not match the required format: JIRA--'); - } else { - console.log('Branch name matches the required format'); - } \ No newline at end of file + - name: Validate Branch + uses: KinsonDigital/BranchValidator@v1.0.0-preview.4 # Make sure this is the latest version + with: + branch-name: "${{ github.ref }}" # The current branch where the workflow is running. + validation-logic: "equalTo('feature/#-*') && equalTo('bugfix/#-*') && equalTo('hotfix/#-*') && equalTo('release/#-*')" + trim-from-start: "refs/heads/" + fail-when-not-valid: true \ No newline at end of file From 83cc31d6aa9033ed457b27dfc78eb5f3aecf1dde Mon Sep 17 00:00:00 2001 From: youssefmdev22 Date: Wed, 3 Sep 2025 04:45:09 +0300 Subject: [PATCH 13/17] Update branch_name_check_action.yaml --- .github/workflows/branch_name_check_action.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/branch_name_check_action.yaml b/.github/workflows/branch_name_check_action.yaml index 4ed0826..e7a7045 100644 --- a/.github/workflows/branch_name_check_action.yaml +++ b/.github/workflows/branch_name_check_action.yaml @@ -19,9 +19,9 @@ jobs: - uses: actions/checkout@v4 - name: Validate Branch - uses: KinsonDigital/BranchValidator@v1.0.0-preview.4 # Make sure this is the latest version + uses: KinsonDigital/BranchValidator@v1.0.0-preview.4 with: - branch-name: "${{ github.ref }}" # The current branch where the workflow is running. + branch-name: "${{ github.head_ref }}" validation-logic: "equalTo('feature/#-*') && equalTo('bugfix/#-*') && equalTo('hotfix/#-*') && equalTo('release/#-*')" - trim-from-start: "refs/heads/" - fail-when-not-valid: true \ No newline at end of file + trim-from-start: "" + fail-when-not-valid: true From d1ae7ef1af5723cc18674a2bb28b82f89267a1bd Mon Sep 17 00:00:00 2001 From: youssefmdev22 Date: Wed, 3 Sep 2025 04:48:14 +0300 Subject: [PATCH 14/17] Update branch_name_check_action.yaml --- .github/workflows/branch_name_check_action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/branch_name_check_action.yaml b/.github/workflows/branch_name_check_action.yaml index e7a7045..192a002 100644 --- a/.github/workflows/branch_name_check_action.yaml +++ b/.github/workflows/branch_name_check_action.yaml @@ -22,6 +22,6 @@ jobs: uses: KinsonDigital/BranchValidator@v1.0.0-preview.4 with: branch-name: "${{ github.head_ref }}" - validation-logic: "equalTo('feature/#-*') && equalTo('bugfix/#-*') && equalTo('hotfix/#-*') && equalTo('release/#-*')" + validation-logic: "matches('^(feature|bugfix|hotfix|release)/[A-Z]+-[0-9]+(/.+)?$')" trim-from-start: "" fail-when-not-valid: true From 95cb423dd04da7cc92ee42e0fac8b7cc3a63ff0e Mon Sep 17 00:00:00 2001 From: youssefmdev22 Date: Wed, 3 Sep 2025 04:49:26 +0300 Subject: [PATCH 15/17] Update branch_name_check_action.yaml --- .github/workflows/branch_name_check_action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/branch_name_check_action.yaml b/.github/workflows/branch_name_check_action.yaml index 192a002..6fe74a2 100644 --- a/.github/workflows/branch_name_check_action.yaml +++ b/.github/workflows/branch_name_check_action.yaml @@ -22,6 +22,6 @@ jobs: uses: KinsonDigital/BranchValidator@v1.0.0-preview.4 with: branch-name: "${{ github.head_ref }}" - validation-logic: "matches('^(feature|bugfix|hotfix|release)/[A-Z]+-[0-9]+(/.+)?$')" + validation-logic: matches('^(feature|bugfix|hotfix|release)/[A-Z]+-[0-9]+(/.+)?$') trim-from-start: "" fail-when-not-valid: true From 844e8bd9cd89d9ed34283ccf672d0dddbe9afb5e Mon Sep 17 00:00:00 2001 From: youssefmdev22 Date: Wed, 3 Sep 2025 04:53:09 +0300 Subject: [PATCH 16/17] Update branch_name_check_action.yaml --- .github/workflows/branch_name_check_action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/branch_name_check_action.yaml b/.github/workflows/branch_name_check_action.yaml index 6fe74a2..c2daf22 100644 --- a/.github/workflows/branch_name_check_action.yaml +++ b/.github/workflows/branch_name_check_action.yaml @@ -22,6 +22,6 @@ jobs: uses: KinsonDigital/BranchValidator@v1.0.0-preview.4 with: branch-name: "${{ github.head_ref }}" - validation-logic: matches('^(feature|bugfix|hotfix|release)/[A-Z]+-[0-9]+(/.+)?$') + validation-logic: "startsWith('feature/') || startsWith('bugfix/') || startsWith('hotfix/') || startsWith('release/')" trim-from-start: "" fail-when-not-valid: true From 5e87f9c4c2e55b737057612ce436304b101d6d63 Mon Sep 17 00:00:00 2001 From: youssefmdev22 Date: Wed, 3 Sep 2025 04:54:21 +0300 Subject: [PATCH 17/17] Update branch_name_check_action.yaml --- .github/workflows/branch_name_check_action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/branch_name_check_action.yaml b/.github/workflows/branch_name_check_action.yaml index c2daf22..9e50991 100644 --- a/.github/workflows/branch_name_check_action.yaml +++ b/.github/workflows/branch_name_check_action.yaml @@ -22,6 +22,6 @@ jobs: uses: KinsonDigital/BranchValidator@v1.0.0-preview.4 with: branch-name: "${{ github.head_ref }}" - validation-logic: "startsWith('feature/') || startsWith('bugfix/') || startsWith('hotfix/') || startsWith('release/')" + validation-logic: "equalTo('feature/ECOM-*/**') || equalTo('bugfix/ECOM-*/**') || equalTo('hotfix/ECOM-*/**') || equalTo('release/ECOM-*/**')" trim-from-start: "" fail-when-not-valid: true