diff --git a/.github/auto_assign.yml b/.github/auto_assign.yml new file mode 100644 index 00000000..06d53bbb --- /dev/null +++ b/.github/auto_assign.yml @@ -0,0 +1,26 @@ +# Set to true to add reviewers to pull requests +addReviewers: true + +# Set to true to add assignees to pull requests +addAssignees: false + +# A list of reviewers to be added to pull requests (GitHub user name) +reviewers: + - mimshins + +# A number of reviewers added to the pull request +# Set 0 to add all the reviewers (default: 0) +numberOfReviewers: 0 +# A list of assignees, overrides reviewers if set +assignees: + - amir78729 + - mimshins + +# A number of assignees to add to the pull request +# Set to 0 to add all of the assignees. +# Uses numberOfReviewers if unset. +numberOfAssignees: 2 + +# A list of keywords to be skipped the process that add reviewers if pull requests include it +skipKeywords: + - wip diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index f3d8d01d..3dacabf0 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -1,4 +1,4 @@ -name: 🧑‍💻 Development +name: "🧑‍💻 Development" on: pull_request: @@ -37,7 +37,7 @@ jobs: run: pnpm install - name: 🔍 lint code - run: pnpm lint + run: pnpm check:lint test: needs: lint diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml new file mode 100644 index 00000000..40355580 --- /dev/null +++ b/.github/workflows/review.yml @@ -0,0 +1,51 @@ +name: 🔍 Review + +on: + workflow_run: + workflows: ["🧑‍💻 Development"] + types: + - completed + +permissions: + contents: read + pull-requests: write + actions: read + +jobs: + add-reviews: + name: 👥 Auto-assign Reviewer and Assignee + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - name: 👤 assigning reviewer and assignee + uses: kentaro-m/auto-assign-action@v2.0.0 + + danger: + name: ⚡ Danger Check + runs-on: ubuntu-latest + timeout-minutes: 10 + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - name: ☁️ checkout repository associated with PR + uses: actions/checkout@v4 + with: + ref: ${{ github.event.workflow_run.head_branch }} + + - name: 🔧 setup pnpm + uses: pnpm/action-setup@v3 + with: + version: 9 + + - name: 🔧 setup node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "pnpm" + + - name: 📦 install dependencies + run: pnpm install + + - name: ⚡ run danger file + run: pnpm check:danger + env: + DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/dangerfile.ts b/dangerfile.ts new file mode 100644 index 00000000..d84c57ce --- /dev/null +++ b/dangerfile.ts @@ -0,0 +1,14 @@ +import { + checkLockFile, + checkPlayground, + DangerClient, +} from "@internals/danger"; +import { danger } from "danger"; + +void (async () => { + const dangerClient = new DangerClient(danger); + + dangerClient.use(checkLockFile); + dangerClient.use(checkPlayground); + await dangerClient.analyze(); +})(); diff --git a/eslint.config.js b/eslint.config.js index c745dcb7..ecdb42d2 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -60,9 +60,26 @@ export default config( }, }, { + files: ["*", "!**/scripts/**/*"], rules: { - "no-alert": "error", "no-console": "warn", + }, + }, + { + files: ["*", "!internals/danger/**/*"], + rules: { + "import/extensions": [ + "error", + "always", + { + ignorePackages: true, + }, + ], + }, + }, + { + rules: { + "no-alert": "error", "prefer-const": "error", "default-case": "error", "eol-last": "error", @@ -71,13 +88,6 @@ export default config( "no-unused-private-class-members": "warn", "no-promise-executor-return": "error", "no-unmodified-loop-condition": "warn", - "import/extensions": [ - "error", - "always", - { - ignorePackages: true, - }, - ], eqeqeq: ["error", "smart"], "no-duplicate-imports": [ "error", @@ -139,6 +149,8 @@ export default config( }, ], }, + }, + { settings: { "import/resolver": { typescript: { diff --git a/internals/danger/DangerClient.ts b/internals/danger/DangerClient.ts new file mode 100644 index 00000000..948997b7 --- /dev/null +++ b/internals/danger/DangerClient.ts @@ -0,0 +1,109 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { + type DangerDSLType, + type DangerResults, + type GitDSL, + type GitHubDSL, + type GitLabDSL, +} from "danger"; + +declare let results: DangerResults; +declare const warn: (msg: string, file?: string, line?: number) => void; +declare const fail: (msg: string, file?: string, line?: number) => void; +declare const message: (msg: string, file?: string, line?: number) => void; +declare const markdown: (msg: string, file?: string, line?: number) => void; +export type PluginRuntime