Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update Octokit import to use rest module #16

Merged
merged 5 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/knip.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { KnipConfig } from "knip";

const config: KnipConfig = {
entry: ["build/index.ts", ".github/empty-string-checker.ts"],
entry: ["src/index.ts"],
project: ["src/**/*.ts"],
ignore: ["src/types/config.ts", "**/__mocks__/**", "**/__fixtures__/**"],
ignore: ["**/__mocks__/**", "**/__fixtures__/**"],
ignoreExportsUsedInFile: true,
// eslint can also be safely ignored as per the docs: https://knip.dev/guides/handling-issues#eslint--jest
ignoreDependencies: ["eslint-config-prettier", "eslint-plugin-prettier", "@types/jest", "@mswjs/data", "tsx"],
ignoreDependencies: ["eslint-config-prettier", "eslint-plugin-prettier", "@types/jest", "@mswjs/data", "tsx", "simple-git"],
eslint: true,
};

Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/cspell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v2

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.10.0"

- name: Install cspell
run: yarn add cspell
run: bun add -D cspell

- name: Run cspell
run: yarn format:cspell
run: bun format:cspell
10 changes: 4 additions & 6 deletions .github/workflows/knip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,21 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

# needed to use yarn v4
- name: Enable corepack
run: corepack enable

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.10.0

- uses: oven-sh/setup-bun@v2

- name: Install toolchain
run: yarn install
run: bun install

- name: Store PR number
run: echo ${{ github.event.number }} > pr-number.txt

- name: Run Knip
run: yarn knip || yarn knip --reporter json > knip-results.json
run: bun knip || bun knip --reporter json > knip-results.json

- name: Upload knip result
if: failure()
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/no-empty-strings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ jobs:
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: oven-sh/setup-bun@v2
- name: Install Dependencies
run: |
yarn add tsx simple-git
bun add -D simple-git
- name: Check for Empty Strings
run: |
yarn tsx .github/empty-string-checker.ts
bun .github/empty-string-checker.ts
env:
GITHUB_TOKEN: ${{ steps.get_installation_token.outputs.token }}
GITHUB_REPOSITORY: ${{ github.repository }}
Expand Down
Binary file modified bun.lockb
Binary file not shown.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,14 @@
"dependencies": {
"@actions/core": "^1.11.1",
"@actions/github": "^6.0.0",
"@octokit/core": "^6.1.2",
"@octokit/plugin-paginate-graphql": "^5.2.4",
"@octokit/plugin-paginate-rest": "^11.3.5",
"@octokit/plugin-rest-endpoint-methods": "^13.2.6",
"@octokit/plugin-retry": "^7.1.2",
"@octokit/plugin-throttling": "^9.3.2",
"@octokit/rest": "^21.0.2",
"@octokit/types": "^13.6.1",
"@octokit/webhooks": "^13.3.0",
"@sinclair/typebox": "^0.33.20",
"@ubiquity-os/ubiquity-os-logger": "^1.3.2",
Expand All @@ -59,7 +64,6 @@
"@eslint/js": "^9.14.0",
"@jest/globals": "29.7.0",
"@mswjs/data": "0.16.1",
"@octokit/rest": "^21.0.2",
"@types/jest": "29.5.12",
"@types/node": "^20.11.19",
"cspell": "^8.4.0",
Expand Down
4 changes: 2 additions & 2 deletions src/octokit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Octokit } from "@octokit/core";
import { Octokit } from "@octokit/rest";
import { RequestOptions } from "@octokit/types";
import { paginateRest } from "@octokit/plugin-paginate-rest";
import { restEndpointMethods } from "@octokit/plugin-rest-endpoint-methods";
Expand All @@ -24,5 +24,5 @@ const defaultOptions = {
};

export const customOctokit = Octokit.plugin(throttling, retry, paginateRest, restEndpointMethods, paginateGraphQL).defaults((instanceOptions: object) => {
return Object.assign({}, defaultOptions, instanceOptions);
return { ...defaultOptions, ...instanceOptions};
});
Loading