Skip to content

Repo sync #33459

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

Merged
merged 4 commits into from
Jun 11, 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
3 changes: 3 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions content/copilot/github-copilot-enterprise/index.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
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:
feature: copilot
children:
- /overview
- /copilot-pull-request-summaries
- /managing-copilot-knowledge-bases
---

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -21,3 +22,4 @@ children:
- /reviewing-audit-logs-for-copilot-business
- /canceling-copilot-for-your-organization
---

Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
75 changes: 75 additions & 0 deletions src/events/scripts/analyze-comment-cli.ts
Original file line number Diff line number Diff line change
@@ -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 <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))}`))
}
}
Loading