From f9a71f0ca0d4d529b410c168d9ee2d4c9a167f81 Mon Sep 17 00:00:00 2001 From: "aleksey.pronin" Date: Wed, 3 Jul 2024 09:38:26 +0300 Subject: [PATCH] add validation action --- .github/actions/validation/action.yml | 9 +++++++++ .github/workflows/publish.yml | 3 +++ .github/workflows/publish_prerelease.yml | 3 +++ .github/workflows/pull_request.yml | 19 +++++++++++++++++++ package.json | 7 ++++--- 5 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 .github/actions/validation/action.yml create mode 100644 .github/workflows/pull_request.yml diff --git a/.github/actions/validation/action.yml b/.github/actions/validation/action.yml new file mode 100644 index 0000000..34e3bce --- /dev/null +++ b/.github/actions/validation/action.yml @@ -0,0 +1,9 @@ +name: 'Validation' +description: It runs linter and prettier checks + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Run linters + run: yarn lint:ci diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 557c1b5..f306fdf 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -33,6 +33,9 @@ jobs: with: version: ${{ github.event.inputs.new_version }} + - name: Validation + uses: ./.github/actions/validation + - name: Complete publish uses: ./.github/actions/complete-publish with: diff --git a/.github/workflows/publish_prerelease.yml b/.github/workflows/publish_prerelease.yml index a0dec43..d699659 100644 --- a/.github/workflows/publish_prerelease.yml +++ b/.github/workflows/publish_prerelease.yml @@ -47,6 +47,9 @@ jobs: version: ${{ github.event.inputs.custom_version || github.event.inputs.new_version }} npm_tag: ${{ github.event.inputs.npm_tag }} + - name: Validation + uses: ./.github/actions/validation + - name: Complete publish uses: ./.github/actions/complete-publish with: diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 0000000..03a8eb1 --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,19 @@ +name: 'Pull Request' + +on: + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + token: ${{ secrets.DEVTOOLS_GITHUB_TOKEN }} + + - name: Setting up the repository environment + uses: ./.github/actions/setup + + - name: Validation + uses: ./.github/actions/validation diff --git a/package.json b/package.json index 6b9add7..c91098a 100644 --- a/package.json +++ b/package.json @@ -20,9 +20,10 @@ }, "scripts": { "build": "tsc", - "eslint:check": "eslint src/ --ext ts,tsx", - "eslint:fix": "eslint src/ --ext ts,tsx", - "prettier:check": "prettier --check .", + "lint:eslint": "eslint src/ --ext ts,tsx", + "lint:fix": "eslint src/ --ext ts,tsx", + "lint:prettier": "prettier --check .", + "lint:ci": "yarn lint:eslint && yarn lint:prettier", "prettier:fix": "prettier --write .", "prepare": "husky install", "prepublishOnly": "yarn build"