Skip to content
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
20 changes: 20 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
on:
push:
branches:
- main
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: pnpm/action-setup@v4
with:
version: 10
- run: pnpm install
- run: pnpm lint
- run: pnpm format
- run: pnpm build
- run: pnpm test
Comment on lines +9 to +20

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 4 months ago

To fix the error, set the permissions key to restrict the GITHUB_TOKEN to the minimum required privilege. In this case, all workflow steps are read-only operations (checkout, install, lint, format, build, test), so only contents: read is needed. This can be set at the workflow level (top-level, applying to all jobs) or at the job level (under jobs.test). The best and simplest fix is to add a top-level permissions: block with contents: read directly below the workflow name (or at the top, before on: if no name is present), ensuring all jobs inherit this restriction.

Changes needed:

  • Insert permissions:\n contents: read after line 1 (directly after or before on:; both are valid, but after on: is most conventional if no workflow name exists).
  • No other changes or imports are needed.

Suggested changeset 1
.github/workflows/main.yaml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
--- a/.github/workflows/main.yaml
+++ b/.github/workflows/main.yaml
@@ -4,6 +4,9 @@
       - main
   pull_request:
 
+permissions:
+  contents: read
+
 jobs:
   test:
     runs-on: ubuntu-latest
EOF
@@ -4,6 +4,9 @@
- main
pull_request:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
Copilot is powered by AI and may make mistakes. Always verify output.
16 changes: 10 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ name: Release
on:
push:
tags:
- '*'
- "*"

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: pnpm/action-setup@v4
with:
version: 10
- run: pnpm install
- run: pnpm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm-lock.yaml
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Weaviate Agents JS/TS client <img alt='Weaviate logo' src='https://weaviate.io/img/site/weaviate-logo-light.png' width='148' align='right' />
# Weaviate Agents JS/TS client <img alt='Weaviate logo' src='https://weaviate.io/img/site/weaviate-logo-light.png' width='148' align='right' /> &middot; [![npm version](https://img.shields.io/npm/v/weaviate-agents)](https://www.npmjs.com/package/weaviate-agents)

JS/TS client for Weaviate Agents.

Expand Down
26 changes: 13 additions & 13 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import js from "@eslint/js";
import globals from "globals";
import tseslint from "typescript-eslint";
import { defineConfig } from "eslint/config";

import { defineConfig, globalIgnores } from "eslint/config";

export default defineConfig([
{ files: ["**/*.{ts}"], plugins: { js }, extends: ["js/recommended"] },
{ files: ["**/*.{ts}"], languageOptions: { globals: globals.node } },
tseslint.configs.recommended,
globalIgnores(["dist"]),
{
rules: {
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'default',
format: ['camelCase', 'PascalCase'],
},
{
selector: ['objectLiteralProperty', 'typeProperty'],
format: null,
},
],
"@typescript-eslint/naming-convention": [
"error",
{
selector: "default",
format: ["camelCase", "PascalCase"],
},
{
selector: ["objectLiteralProperty", "typeProperty"],
format: null,
},
],
},
},
]);
10 changes: 10 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { createDefaultPreset } from "ts-jest";

/** @type {import("jest").Config} **/
export default {
...createDefaultPreset(),
moduleNameMapper: {
"^(\\.{1,2}/.*)\\.js$": "$1",
},
testPathIgnorePatterns: ["dist"],
};
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"node": ">=20.0.0"
},
"scripts": {
"lint": "eslint",
"format": "prettier --check .",
"build": "tsc",
"test": "jest",
"prepack": "pnpm build"
},
"repository": {
Expand All @@ -28,9 +31,13 @@
},
"devDependencies": {
"@eslint/js": "^9.26.0",
"@types/jest": "^30.0.0",
"eslint": "^9.26.0",
"globals": "^16.1.0",
"jest": "^30.0.4",
"prettier": "^3.6.2",
"ts-jest": "^29.4.0",
"typescript": "^5.8.3",
"typescript-eslint": "^8.32.1"
}
}
}
Loading