diff --git a/.github/workflows/lint-commits.yml b/.github/workflows/lint-commits.yml new file mode 100644 index 00000000..71032dc8 --- /dev/null +++ b/.github/workflows/lint-commits.yml @@ -0,0 +1,20 @@ +on: + workflow_call: + +jobs: + lint-commits: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'yarn' + - run: yarn install --frozen-lockfile + - id: commitlint + run: echo ::set-output name=config_path::$(node -e "process.stdout.write(require('@dhis2/cli-style').config.commitlint)") + - uses: wagoid/commitlint-github-action@v4 + with: + configFile: ${{ steps.commitlint.outputs.config_path }} diff --git a/.github/workflows/lint-pr-title-reusable.yml b/.github/workflows/lint-pr-title-reusable.yml new file mode 100644 index 00000000..1fc29af8 --- /dev/null +++ b/.github/workflows/lint-pr-title-reusable.yml @@ -0,0 +1,18 @@ +on: + workflow_call: + +jobs: + lint-pr-title: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'yarn' + - run: yarn install --frozen-lockfile + - id: commitlint + run: echo ::set-output name=config_path::$(node -e "process.stdout.write(require('@dhis2/cli-style').config.commitlint)") + - uses: JulienKode/pull-request-name-linter-action@v0.5.0 + with: + configuration-path: ${{ steps.commitlint.outputs.config_path }} diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml new file mode 100644 index 00000000..fbfd8440 --- /dev/null +++ b/.github/workflows/lint-pr-title.yml @@ -0,0 +1,9 @@ +name: lint-pr-title + +on: + pull_request: + types: ['opened', 'edited', 'reopened', 'synchronize'] + +jobs: + lint-pr-title: + uses: ./.github/workflows/lint-pr-title-reusable.yml diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml index 603ab0a6..edb44560 100644 --- a/.github/workflows/test-and-release.yml +++ b/.github/workflows/test-and-release.yml @@ -8,6 +8,8 @@ concurrency: cancel-in-progress: ${{ !contains(github.ref, fromJSON('["master", "main"]')) }} jobs: + lint-commits: + uses: ./.github/workflows/lint-commits.yml lint: uses: ./.github/workflows/lint.yml test: diff --git a/.github/workflows/verify-commits.yml b/.github/workflows/verify-commits.yml deleted file mode 100644 index 3e25db88..00000000 --- a/.github/workflows/verify-commits.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: 'dhis2: verify (commits)' - -on: - pull_request: - types: ['opened', 'edited', 'reopened', 'synchronize'] - -jobs: - lint-pr-title: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v3 - with: - node-version: 20 - cache: 'yarn' - - run: yarn install --frozen-lockfile - - id: commitlint - run: echo ::set-output name=config_path::$(node -e "process.stdout.write(require('@dhis2/cli-style').config.commitlint)") - - uses: JulienKode/pull-request-name-linter-action@v0.5.0 - with: - configuration-path: ${{ steps.commitlint.outputs.config_path }} - - lint-commits: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - uses: actions/setup-node@v3 - with: - node-version: 20 - cache: 'yarn' - - run: yarn install --frozen-lockfile - - id: commitlint - run: echo ::set-output name=config_path::$(node -e "process.stdout.write(require('@dhis2/cli-style').config.commitlint)") - - uses: wagoid/commitlint-github-action@v4 - with: - configFile: ${{ steps.commitlint.outputs.config_path }}