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
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
days-before-stale: 30
days-before-close: 14
stale-pr-label: 'stale'
exempt-pr-labels: 'never-stale'
exempt-pr-labels: 'never-stale,localization'
close-pr-label: 'Closed as inactive'

operations-per-run: 150
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/triage-stale-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
stale-issue-label: 'Inactive'
close-issue-label: 'Closed as inactive'

exempt-pr-labels: 'never-stale,ready to merge,waiting for review,needs SME'
exempt-pr-labels: 'never-stale,localization,ready to merge,waiting for review,needs SME'
stale-pr-message: 'A stale label has been added to this pull request because it has been open 30 days with no activity. If you think this pull request should remain open, please add a new comment.'
stale-pr-label: 'Inactive'
close-pr-label: 'Closed as inactive'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ Enabling the organization setting enables AI Scan immediately for all eligible r

You do not need to select a model to enable AI Scan.

> [!NOTE]
> {% data reusables.code-scanning.ai-scan-model-policies %}
* **Enterprise**: Enterprise owners can allow or prevent organizations from enabling AI Scan. The policy is set to "Not allowed" by default. This policy controls both AI Scan on pull requests and AI Scan for a repository's backlog. Allowing AI Scan does not enable it automatically. See [AUTOTITLE](/enterprise-cloud@latest/admin/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-code-security-and-analysis-for-your-enterprise#enforcing-a-policy-to-manage-ai-scan-in-your-enterprises-repositories).
* **Organization**: Organization owners and security managers can enable AI Scan for pull requests for eligible repositories. Repositories inherit the organization setting. See [AUTOTITLE](/code-security/how-tos/secure-at-scale/configure-organization-security/establish-complete-coverage/configure-global-settings#enabling-ai-scan-for-pull-requests).
* **Organization-owned repository**: People with admin access to the repository can opt out when the organization has enabled AI Scan. They cannot opt in when the organization setting is disabled.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ AI Scan for repositories supports all languages, including languages already sup

## Enabling AI Scan for repositories

> [!NOTE]
> {% data reusables.code-scanning.ai-scan-model-policies %}

Before enabling AI Scan for repositories, confirm repository eligibility, review the billing account's included {% data variables.product.prodname_ai_credits_short %}, and configure budgets for metered usage.

* **Enterprise**: Enterprise owners can allow or prevent organizations from enabling AI Scan for repositories. This policy controls both AI Scan on pull requests and AI Scan for a repository's backlog. The policy is set to "Not allowed" by default. Allowing AI Scan does not enable it automatically. See [AUTOTITLE](/enterprise-cloud@latest/admin/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-code-security-and-analysis-for-your-enterprise#enforcing-a-policy-to-manage-ai-scan-in-your-enterprises-repositories).
Expand Down
29 changes: 28 additions & 1 deletion content/integrations/how-tos/using-github-event-streams.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Event Streams is only available on {% data variables.product.prodname_dotcom_the

## Quickstart

These examples use the [{% data variables.product.prodname_cli %}](https://cli.github.com/) (`gh`) for the API calls and `curl` for the stream.
These examples use the [{% data variables.product.prodname_cli %}](https://cli.github.com/) (`gh`) for the API calls and `curl` for the stream, so you can see each step of the API. If you use {% data variables.product.prodname_cli %} 2.105.0 or later, the `gh event` commands handle subscribing, streaming, and reconnecting for you. See [Using {% data variables.product.prodname_cli %} commands](#using-github-cli-commands).

### 1. Create a subscription

Expand Down Expand Up @@ -77,6 +77,32 @@ When you've finished, close the stream. Deleting a subscription doesn't close it
gh api -X DELETE /event-subscriptions/ID
```

## Using {% data variables.product.prodname_cli %} commands

{% data variables.product.prodname_cli %} 2.105.0 and later include `gh event` commands for Event Streams. These commands are also in {% data variables.release-phases.public_preview %} and subject to change.

To wait for an event on a pull request, run `gh event listen` with the pull request's URL and one or more event types:

```shell
gh event listen --resource https://github.com/OWNER/REPO/pull/NUMBER \
--event com.github.pull_request.review.submitted.v1,com.github.pull_request.state.changed.v1
```

`gh event listen` creates a subscription, or reuses your existing one for the same pull request and event types. It then opens the stream and prints each event as one line of JSON. It reconnects when the stream drops, and creates the subscription again if it expires.

* By default, the command exits after the first event. This suits agents, which usually wait for a command to finish before they continue.
* `--count N` exits after N events, and `--follow` keeps listening until you stop it.
* `--timeout` stops waiting after a duration such as `30m`, and exits with status `8`.
* `--jq` and `--template` format each event, as with `gh api`. For example, `--jq .data.conclusion` prints only a check suite's conclusion.

The command prints `Listening for events.` to stderr once the stream is open. Changes made before then aren't reported, so read the pull request's current state after you see this line.

To manage subscriptions directly, use `gh event subscription list`, `create`, `view`, and `delete`. `gh event listen` doesn't delete its subscription when it exits. Subscriptions expire after 24 hours.

When `gh` detects that an agent is calling it, commands such as `gh pr create`, `gh pr view`, `gh run view`, `gh run watch`, and `gh api` suggest `gh event listen` instead of polling.

For all options, run `gh event listen --help`.

## API reference

All routes are on `https://api.github.com`.
Expand Down Expand Up @@ -173,6 +199,7 @@ Error responses include `message`, `documentation_url`, and `status`.
* **No "all checks completed" event:** you get one event per check suite. To know whether all checks are done, fetch the pull request's check suites after each event.
* **Pull request conversation comments:** comments on the pull request's conversation tab don't produce events yet. Review comments do, as review events.
* **Open streams after deletion:** deleting a subscription doesn't close its open streams yet. Close the stream yourself before you delete the subscription.
* **Commit statuses:** check suite events don't cover commit statuses created with the REST API. If a pull request's required checks include commit statuses, fetch them separately.
* **No replay:** see [Handling the stream](#handling-the-stream).

## Giving feedback
Expand Down
1 change: 1 addition & 0 deletions data/reusables/code-scanning/ai-scan-model-policies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AI Scan features do not respect the models enabled in the {% data variables.product.prodname_copilot_short %} **Configure models** policy for your enterprise or organization, so AI Scan may use models that the policy doesn't allow. To control whether AI Scan can run, use the AI Scan settings and enterprise policy instead.
Loading