diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 33ca44d999cb..a27be1874a02 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -10,6 +10,9 @@ on: - main paths: - '**/*.js' + - '**/*.ts' + - '**/*.jsx' + - '**/*.tsx' - '.github/workflows/codeql.yml' # This is so that when CodeQL runs on a pull request, it can compare # against the state of the base branch. diff --git a/content/copilot/github-copilot-enterprise/index.md b/content/copilot/github-copilot-enterprise/index.md index 7641154e428b..7a131b834895 100644 --- a/content/copilot/github-copilot-enterprise/index.md +++ b/content/copilot/github-copilot-enterprise/index.md @@ -1,7 +1,7 @@ --- title: GitHub Copilot Enterprise shortTitle: Copilot Enterprise -intro: 'Learn about GitHub Copilot Enterprise and the features available with it.' +intro: Learn about GitHub Copilot Enterprise and the features available with it. topics: - Copilot versions: @@ -9,5 +9,5 @@ versions: children: - /overview - /copilot-pull-request-summaries - - /managing-copilot-knowledge-bases --- + diff --git a/content/copilot/managing-copilot/managing-github-copilot-in-your-organization/index.md b/content/copilot/managing-copilot/managing-github-copilot-in-your-organization/index.md index eaf52f7e06d6..54de934aebf5 100644 --- a/content/copilot/managing-copilot/managing-github-copilot-in-your-organization/index.md +++ b/content/copilot/managing-copilot/managing-github-copilot-in-your-organization/index.md @@ -13,6 +13,7 @@ topics: children: - /subscribing-to-copilot-for-your-organization - /granting-access-to-copilot-for-members-of-your-organization + - /managing-copilot-knowledge-bases - /managing-requests-for-copilot-access-in-your-organization - /revoking-access-to-copilot-for-members-of-your-organization - /reviewing-usage-data-for-github-copilot-in-your-organization @@ -21,3 +22,4 @@ children: - /reviewing-audit-logs-for-copilot-business - /canceling-copilot-for-your-organization --- + diff --git a/content/copilot/github-copilot-enterprise/managing-copilot-knowledge-bases.md b/content/copilot/managing-copilot/managing-github-copilot-in-your-organization/managing-copilot-knowledge-bases.md similarity index 98% rename from content/copilot/github-copilot-enterprise/managing-copilot-knowledge-bases.md rename to content/copilot/managing-copilot/managing-github-copilot-in-your-organization/managing-copilot-knowledge-bases.md index f579a57d1b52..d7fa55222fd2 100644 --- a/content/copilot/github-copilot-enterprise/managing-copilot-knowledge-bases.md +++ b/content/copilot/managing-copilot/managing-github-copilot-in-your-organization/managing-copilot-knowledge-bases.md @@ -11,6 +11,7 @@ redirect_from: - /copilot/github-copilot-enterprise/copilot-docset-management - /copilot/github-copilot-enterprise/copilot-chat-in-github/managing-copilot-knowledge-bases - /copilot/github-copilot-chat/copilot-chat-in-github/managing-copilot-knowledge-bases + - /copilot/github-copilot-enterprise/managing-copilot-knowledge-bases --- {% ifversion fpt %} diff --git a/content/copilot/managing-copilot/managing-github-copilot-in-your-organization/managing-requests-for-copilot-access-in-your-organization.md b/content/copilot/managing-copilot/managing-github-copilot-in-your-organization/managing-requests-for-copilot-access-in-your-organization.md index 571e6fcde216..136f4bf9526a 100644 --- a/content/copilot/managing-copilot/managing-github-copilot-in-your-organization/managing-requests-for-copilot-access-in-your-organization.md +++ b/content/copilot/managing-copilot/managing-github-copilot-in-your-organization/managing-requests-for-copilot-access-in-your-organization.md @@ -1,5 +1,5 @@ --- -title: Managing requests for copilot access in your organization +title: Managing requests for Copilot access in your organization shortTitle: Manage requests for access intro: 'Approve or deny requests for {% data variables.product.prodname_copilot_short %} access in your organization.' permissions: Organization owners diff --git a/package.json b/package.json index 4ad0802974bc..d44e31bb3dc1 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "scripts": { "all-documents": "tsx src/content-render/scripts/all-documents/cli.ts", "analyze-text": "node src/search/scripts/analyze-text.js", + "analyze-comment": "tsx src/events/scripts/analyze-comment-cli.ts", "archive-version": "node --max-old-space-size=8192 src/ghes-releases/scripts/archive-version.js", "audit-log-sync": "tsx src/audit-logs/scripts/sync.ts", "build": "next build", diff --git a/src/events/scripts/analyze-comment-cli.ts b/src/events/scripts/analyze-comment-cli.ts new file mode 100644 index 000000000000..c15534a3ed16 --- /dev/null +++ b/src/events/scripts/analyze-comment-cli.ts @@ -0,0 +1,75 @@ +/** + * This script can be used to debug and test our signals. + * Example use: + * + * npm run analyze-comment -- "I love this site\!" --verbose + * + * or, using stdin: + * + * cat naught-comment.txt | npm run analyze-comment + * + */ + +import fs from 'node:fs' +import util from 'node:util' + +import chalk from 'chalk' +import { program } from 'commander' + +import { SIGNAL_RATINGS } from '../analyze-comment' + +type Options = { + language?: string + verbose?: boolean +} +program + .description('Analyze a single comment to test how it would be rated.') + .option('-l, --language ', 'Assumed language of the page') + .option('-v, --verbose', "Display all signals it *didn't* trigger") + .argument('[comment]', 'Input (leave blank to read from stdin)') + .action(main) + +program.parse(process.argv) + +async function main(comment?: string, options?: Options) { + if (!comment) { + const stdinBuffer = fs.readFileSync(0) // STDIN_FILENO = 0 + comment = stdinBuffer.toString() + } + if (!comment.trim()) { + console.error(chalk.red('No comment provided')) + return process.exit(1) + } + + console.log(chalk.grey('Comment:'), chalk.bold(util.inspect(comment))) + console.log('') // whitespace + + const language = options?.language || 'en' + + let rating = 1.0 + let broke = false + for (const { reduction, name, validator } of SIGNAL_RATINGS) { + const hit = validator(comment, language) + if (hit) { + console.log( + chalk.yellow( + `Triggered on ${chalk.bold(name)} (${chalk.bold(reduction.toFixed(1))} reduction)`, + ), + ) + rating -= reduction + if (rating <= 0) { + console.log(chalk.red('Rating is now 0.0, stopping')) + broke = true + if (options?.verbose) { + break + } + } + } else if (options?.verbose) { + console.log(chalk.green(`Not triggered on ${chalk.bold(name)}`)) + } + } + console.log('') // whitespace + if (!broke) { + console.log(chalk.whiteBright(`Final rating: ${chalk.bold(rating.toFixed(1))}`)) + } +}