diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..fc9efc2c43 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,71 @@ +name: HRM Dashboard - CI + +on: + push: + branches: + - leader + pull_request: + branches: + - leader + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + ci: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 8 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Lint + run: pnpm run lint + + - name: Type check + run: pnpm exec tsc --noEmit + + - name: Knip + run: pnpm run knip + + - name: Format check + run: pnpm run format:check + + - name: Security audit + run: pnpm audit --prod --audit-level=high + + - name: Validate PR commits + if: github.event_name == 'pull_request' + id: lint + run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose + + - name: Post Comment on Failure + if: failure() && steps.lint.conclusion == 'failure' + uses: peter-evans/create-or-update-comment@v4 + with: + issue-number: ${{ github.event.pull_request.number }} + body: | + :no_entry: **Commit Message Linting Failed** + + One or more of your commit messages do not follow the project's conventions. + Please review the [commitlint logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details. + + You can also refer to the [commit message guidelines](https://github.com/conventional-changelog/commitlint/#what-is-commitlint) for help. diff --git a/.github/workflows/commit-lint.yml b/.github/workflows/commit-lint.yml deleted file mode 100644 index e1d37efd3a..0000000000 --- a/.github/workflows/commit-lint.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Lint Commit Messages -on: [pull_request] - -permissions: - pull-requests: write - -jobs: - commitlint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'pnpm' - - run: pnpm install --frozen-lockfile - - name: Validate PR commits - id: lint - run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose - - name: Post Comment on Failure - if: failure() - uses: peter-evans/create-or-update-comment@v4 - with: - issue-number: ${{ github.event.pull_request.number }} - body: | - :no_entry: **Commit Message Linting Failed** - - One or more of your commit messages do not follow the project's conventions. - Please review the [commitlint logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details. - - You can also refer to the [commit message guidelines](https://github.com/conventional-changelog/commitlint/#what-is-commitlint) for help.