From 9cea345a66daeb4b805e4eecfdeff19c65c1b11d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 13:52:02 +0000 Subject: [PATCH 1/5] Initial plan From dc6e5740878dba2c5e12f696a7a632d1d0e2be8f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 13:53:38 +0000 Subject: [PATCH 2/5] Rewrite CI workflow and update README badges Co-authored-by: nomeguy <85475922+nomeguy@users.noreply.github.com> --- .github/workflows/ci.yml | 127 ++++++++++++++++++++++++++++++--------- README.md | 17 +++--- 2 files changed, 107 insertions(+), 37 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf39eb5..7947273 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,13 +1,27 @@ -name: ci +name: CI -on: - push: - branches: - - master - pull_request: +on: [push, pull_request] jobs: - build: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v3 + + - name: Install Dependency + run: npm install + + - name: Run Lint + run: npm run lint + + - name: Run Format Check + run: npm run format:check + + coverage: + needs: [lint] runs-on: ubuntu-latest services: @@ -30,35 +44,92 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 with: - node-version: 22.21.1 - - run: npm i - - run: npx prisma generate - - run: npx prisma db push - - run: npm run format:check - - run: npm run lint - - run: npx jest --coverage --forceExit - - name: Coveralls Parallel + node-version: ^20 + + - name: Install Dependency + run: npm install + + - name: Generate Prisma Client + run: npx prisma generate + + - name: Push Database Schema + run: npx prisma db push + + - name: Run Coverage + run: npx jest --coverage --forceExit + + - name: Coveralls uses: coverallsapp/github-action@master with: github-token: ${{ secrets.GITHUB_TOKEN }} + parallel: true - finish: - needs: build + test: + needs: [lint] runs-on: ubuntu-latest + strategy: + matrix: + node: [^18, ^20] + + services: + postgres: + image: postgres:latest + ports: + - 5432:5432 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: casbin + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + env: + DATABASE_URL: postgresql://postgres:postgres@localhost:5432/casbin + steps: - - name: Coveralls Finished - uses: coverallsapp/github-action@master + - uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v3 with: - github-token: ${{ secrets.GITHUB_TOKEN }} - parallel-finished: true + node-version: ${{ matrix.node }} + + - name: Install Dependency + run: npm install + + - name: Generate Prisma Client + run: npx prisma generate + + - name: Push Database Schema + run: npx prisma db push + + - name: Run Unit test + run: npm run test + + semantic-release: + needs: [lint, test, coverage] + runs-on: ubuntu-latest + steps: - uses: actions/checkout@v2 - - run: npm i - - run: npm run build - - name: Release - if: github.event_name == 'push' && github.repository == 'node-casbin/prisma-adapter' - run: npx semantic-release + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: ^20 + + - name: Run semantic-release + if: github.repository == 'node-casbin/prisma-adapter' && github.event_name == 'push' + run: | + npm install + npm run build + npx semantic-release env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/README.md b/README.md index 2679636..795291d 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,15 @@ -# Prisma Adapter - +Prisma Adapter +==== +[![CI](https://github.com/node-casbin/prisma-adapter/actions/workflows/ci.yml/badge.svg)](https://github.com/node-casbin/prisma-adapter/actions/workflows/ci.yml) +[![Coverage Status](https://coveralls.io/repos/github/node-casbin/prisma-adapter/badge.svg?branch=master)](https://coveralls.io/github/node-casbin/prisma-adapter?branch=master) [![NPM version][npm-image]][npm-url] [![NPM download][download-image]][download-url] -[![Build Status][ci-image]][ci-url] [![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord&label=discord&color=5865F2)](https://discord.gg/S5UjpzGZjN) -[npm-image]: https://img.shields.io/npm/v/casbin-prisma-adapter.svg -[npm-url]: https://npmjs.org/package/casbin-prisma-adapter -[download-image]: https://img.shields.io/npm/dm/casbin-prisma-adapter.svg -[download-url]: https://npmjs.org/package/casbin-prisma-adapter -[ci-image]: https://github.com/node-casbin/prisma-adapter/workflows/ci/badge.svg?branch=master -[ci-url]: https://github.com/node-casbin/prisma-adapter/actions +[npm-image]: https://img.shields.io/npm/v/casbin-prisma-adapter.svg?style=flat-square +[npm-url]: https://npmjs.com/package/casbin-prisma-adapter +[download-image]: https://img.shields.io/npm/dm/casbin-prisma-adapter.svg?style=flat-square +[download-url]: https://npmjs.com/package/casbin-prisma-adapter Prisma Adapter is the [Prisma](https://github.com/prisma/prisma) adapter for [Node-Casbin](https://github.com/casbin/node-casbin). With this library, Node-Casbin can load policy from Prisma supported database or save policy to it. From cbc152c0f6719889766f10ccdc41c0bcc1ea2429 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 13:54:33 +0000 Subject: [PATCH 3/5] Fix README formatting to match Prettier requirements Co-authored-by: nomeguy <85475922+nomeguy@users.noreply.github.com> --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 795291d..bd99c11 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -Prisma Adapter -==== +# Prisma Adapter + [![CI](https://github.com/node-casbin/prisma-adapter/actions/workflows/ci.yml/badge.svg)](https://github.com/node-casbin/prisma-adapter/actions/workflows/ci.yml) [![Coverage Status](https://coveralls.io/repos/github/node-casbin/prisma-adapter/badge.svg?branch=master)](https://coveralls.io/github/node-casbin/prisma-adapter?branch=master) [![NPM version][npm-image]][npm-url] From 132f5b74d50228fc596befdfb7817a65dde7295a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 13:56:07 +0000 Subject: [PATCH 4/5] Add explicit permissions to CI workflow jobs for security Co-authored-by: nomeguy <85475922+nomeguy@users.noreply.github.com> --- .github/workflows/ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7947273..04806c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,8 @@ on: [push, pull_request] jobs: lint: runs-on: ubuntu-latest + permissions: + contents: read steps: - uses: actions/checkout@v2 @@ -23,6 +25,8 @@ jobs: coverage: needs: [lint] runs-on: ubuntu-latest + permissions: + contents: read services: postgres: @@ -71,6 +75,8 @@ jobs: test: needs: [lint] runs-on: ubuntu-latest + permissions: + contents: read strategy: matrix: node: [^18, ^20] @@ -116,6 +122,9 @@ jobs: semantic-release: needs: [lint, test, coverage] runs-on: ubuntu-latest + permissions: + contents: write + packages: write steps: - uses: actions/checkout@v2 From 34e30537a5e2adf59bce389a0760e4f16815aba0 Mon Sep 17 00:00:00 2001 From: Gucheng <85475922+nomeguy@users.noreply.github.com> Date: Sun, 1 Feb 2026 22:08:40 +0800 Subject: [PATCH 5/5] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 04806c6..ed842bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,7 +79,7 @@ jobs: contents: read strategy: matrix: - node: [^18, ^20] + node: [^20] services: postgres: