From 4b844f538be23d3d86bc5820f9709b79b0eb0f7d Mon Sep 17 00:00:00 2001 From: waylon <1158341873@qq.com> Date: Fri, 6 Sep 2024 16:54:42 +0800 Subject: [PATCH 1/6] feat: update github action config --story=119540612 --- .github/workflows/unittest.yml | 2 +- commitlint.config.js | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index a513a9e..7f5b999 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -23,7 +23,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install Dependencies run: | - python -m pip install --upgrade pip + python -m pip install pip==24.0 pip install -r tests/requirements_test.txt - name: Run Tests run: | diff --git a/commitlint.config.js b/commitlint.config.js index aa306c1..d8baf49 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -28,15 +28,30 @@ const Configuration = { 'perf', 'chore', ], - ] + ], + 'content-rule': [2, 'always'], }, + plugins: [ + { + rules: { + 'content-rule': ({subject}) => { + const pattern = /#\d+$|--story=\d+$|--bug=\d+$/; + return [ + pattern.test(subject.trim()), + `Your subject should contain issue id`, + ]; + } + } + } + ], /* * Functions that return true if commitlint should ignore the given message. */ ignores: [ (commit) => commit === '', (message) => message.includes('Merge'), - (message) => message.includes('merge') + (message) => message.includes('merge'), + (message) => message.includes('ignore') ], /* * Whether commitlint uses the default ignore rules. From c2a54838a8282ce1df7774f460fe81dafc1121d6 Mon Sep 17 00:00:00 2001 From: waylon <1158341873@qq.com> Date: Fri, 6 Sep 2024 17:09:27 +0800 Subject: [PATCH 2/6] fix: fix unit test --story=119540612 --- .github/workflows/unittest.yml | 1 - tests/engine.env | 3 +++ tests/interface.env | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 7f5b999..ea6235c 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -38,7 +38,6 @@ jobs: REDIS = {"host": "localhost", "port": 6379, "db": 0} ' > local_settings.py echo "run interface unit test" - echo "run interface unit test" sh scripts/run_interface_unit_test.sh echo "run engine unit test" sh scripts/run_engine_unit_test.sh \ No newline at end of file diff --git a/tests/engine.env b/tests/engine.env index 5741acb..5362e86 100644 --- a/tests/engine.env +++ b/tests/engine.env @@ -1,5 +1,8 @@ BKPAAS_APP_ID=bkflow BKPAAS_APP_SECRET=bkflow_secret +BKPAAS_MAJOR_VERSION=3 +BK_PAAS_HOST=bk_paas_host +BK_PAAS2_URL=bk_paas2_url BKPAAS_LOGIN_URL=login_url BKPAAS_REMOTE_STATIC_URL=static_url BKPAAS_APIGW_OAUTH_API_URL=apigw_url diff --git a/tests/interface.env b/tests/interface.env index a670ac9..004acaa 100644 --- a/tests/interface.env +++ b/tests/interface.env @@ -1,5 +1,8 @@ BKPAAS_APP_ID=bkflow BKPAAS_APP_SECRET=bkflow_secret +BKPAAS_MAJOR_VERSION=3 +BK_PAAS_HOST=bk_paas_host +BK_PAAS2_URL=bk_paas2_url BKPAAS_LOGIN_URL=login_url BKPAAS_REMOTE_STATIC_URL=static_url BKPAAS_APIGW_OAUTH_API_URL=apigw_url From 5e80c3c673c14751841c8288bd9269534a5f8c02 Mon Sep 17 00:00:00 2001 From: waylon <1158341873@qq.com> Date: Fri, 6 Sep 2024 17:56:07 +0800 Subject: [PATCH 3/6] feat: add eslint github action --story=119540612 --- .github/workflows/eslint.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/eslint.yml diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml new file mode 100644 index 0000000..f6a2fd0 --- /dev/null +++ b/.github/workflows/eslint.yml @@ -0,0 +1,29 @@ +# This is a basic workflow to help you get started with Actions + +name: frontend code eslint + +on: + push: + branches: [ master, develop, release*, feature* ] + pull_request: + branches: [ master, develop, release*, feature* ] + +jobs: + eslint: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Install dependencies + run: | + cd frontend + npm install + + - name: Run Eslint + run: | + cd frontend + npx eslint --ext .js,.vue src/ \ No newline at end of file From 8b5a8e6a19bfbb3eb690a6498e19cfc952a72408 Mon Sep 17 00:00:00 2001 From: waylon <1158341873@qq.com> Date: Fri, 6 Sep 2024 19:54:20 +0800 Subject: [PATCH 4/6] feat: add label-pr action --story=119540612 --- .github/workflows/label-pr.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/label-pr.yml diff --git a/.github/workflows/label-pr.yml b/.github/workflows/label-pr.yml new file mode 100644 index 0000000..ac9e790 --- /dev/null +++ b/.github/workflows/label-pr.yml @@ -0,0 +1,25 @@ +name: "Label PR based on title" + +on: + pull_request: + types: [opened, edited, reopened, synchronize] + +jobs: + label-pr: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Label PR + run: | + PR_TITLE="${{ github.event.pull_request.title }}" + if [[ "$PR_TITLE" == "fix:"* ]]; then + gh pr edit ${{ github.event.pull_request.number }} --add-label bugfix + elif [[ "$PR_TITLE" == "feat:"* ]]; then + gh pr edit ${{ github.event.pull_request.number }} --add-label feature + else + echo "No label with this title: $PR_TITLE" + fi + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 38cb9be6097ba9f3dc8b02c915154fb1759a0e79 Mon Sep 17 00:00:00 2001 From: waylon <1158341873@qq.com> Date: Fri, 6 Sep 2024 21:52:58 +0800 Subject: [PATCH 5/6] feat: add label-pr action --story=119540612 --- .github/workflows/label-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/label-pr.yml b/.github/workflows/label-pr.yml index ac9e790..c22451f 100644 --- a/.github/workflows/label-pr.yml +++ b/.github/workflows/label-pr.yml @@ -1,7 +1,7 @@ name: "Label PR based on title" on: - pull_request: + pull_request_target: types: [opened, edited, reopened, synchronize] jobs: From f7b7422c26e19dd475660faad466d680893b5aa2 Mon Sep 17 00:00:00 2001 From: waylon <1158341873@qq.com> Date: Fri, 6 Sep 2024 21:55:13 +0800 Subject: [PATCH 6/6] feat: add label-pr action --story=119540612 --- .github/workflows/label-pr.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/label-pr.yml b/.github/workflows/label-pr.yml index c22451f..600bc23 100644 --- a/.github/workflows/label-pr.yml +++ b/.github/workflows/label-pr.yml @@ -1,8 +1,7 @@ name: "Label PR based on title" on: - pull_request_target: - types: [opened, edited, reopened, synchronize] +- pull_request_target jobs: label-pr: