From 187ea6bfd3aca080773300e549ca1e2e73ed43f8 Mon Sep 17 00:00:00 2001 From: Chamlai <31847168+VeiveHata@users.noreply.github.com> Date: Wed, 2 Oct 2024 17:22:17 +0200 Subject: [PATCH] Create lint-job.yml (#21) --- .github/workflows/bump-version.yml | 9 +++++--- .github/workflows/lint-job.yml | 36 ++++++++++++++++++++++++++++++ .github/workflows/lint.yml | 28 ++++------------------- 3 files changed, 46 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/lint-job.yml diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index dba4ee1..1ff705f 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -8,8 +8,14 @@ on: permissions: contents: write jobs: + run-linter-job: + uses: ./.github/workflows/lint-job.yml + if: github.event.pull_request.merged == true + with: + branch_name: ${{ github.head_ref }} merge_pr: name: 'Bump Version' + needs: run-linter-job if: github.event.pull_request.merged == true runs-on: ubuntu-latest steps: @@ -40,6 +46,3 @@ jobs: run: pnpm version patch - name: Git push version bump run: git push origin main --follow-tags --force - - id: set-version - name: Output version change - run: pnpm pkg get version diff --git a/.github/workflows/lint-job.yml b/.github/workflows/lint-job.yml new file mode 100644 index 0000000..36c7446 --- /dev/null +++ b/.github/workflows/lint-job.yml @@ -0,0 +1,36 @@ +on: + workflow_call: + inputs: + branch_name: + required: true + type: string + +permissions: + checks: write + contents: write + +jobs: + run-linters: + name: Run linters + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 9.4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 20.12 + cache: 'pnpm' + + - name: Install Node.js dependencies + run: pnpm install + + - name: Run linters + run: pnpm lint diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f0f911f..e107b42 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,27 +10,7 @@ permissions: contents: write jobs: - run-linters: - name: Run linters - runs-on: ubuntu-latest - - steps: - - name: Check out Git repository - uses: actions/checkout@v4 - - - name: Install pnpm - uses: pnpm/action-setup@v4 - with: - version: 9.4 - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: 20.12 - cache: 'pnpm' - - - name: Install Node.js dependencies - run: pnpm install - - - name: Run linters - run: pnpm lint + run-linter-job: + uses: ./.github/workflows/lint-job.yml + with: + branch_name: ${{ github.head_ref }}