Skip to content

Commit 5d5cc2a

Browse files
authored
Merge pull request #45560 from github/repo-sync
Repo sync
2 parents 62c0c32 + 7a22523 commit 5d5cc2a

42 files changed

Lines changed: 923 additions & 290 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/check-for-spammy-issues.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Check for Spammy Issues
22

3-
# **What it does**: This action closes low value pull requests in the open-source repository.
3+
# **What it does**: This action closes low value issues in the open-source repository.
44
# **Why we have it**: We get lots of spam in the open-source repository.
55
# **Who does it impact**: Open-source contributors.
66

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Check for Spammy PRs
2+
3+
# **What it does**: This action closes low value pull requests in the open-source repository.
4+
# **Why we have it**: We get lots of spam in the open-source repository.
5+
# **Who does it impact**: Open-source contributors.
6+
7+
on:
8+
pull_request_target:
9+
types: [opened]
10+
11+
permissions:
12+
contents: read
13+
pull-requests: write
14+
15+
jobs:
16+
spammy-pr-check:
17+
name: Label PRs that only delete files or touch a large number of files
18+
if: github.repository == 'github/docs' && github.event_name == 'pull_request_target'
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3
22+
with:
23+
github-token: ${{ secrets.DOCS_BOT_PAT_BASE }}
24+
script: |
25+
const owner = 'github'
26+
const repo = 'docs'
27+
const pull_number = context.payload.pull_request.number
28+
29+
const { data: files } = await github.rest.pulls.listFiles({
30+
owner: owner,
31+
repo: repo,
32+
pull_number: pull_number,
33+
});
34+
35+
const onlyDeletes = files.length > 0 && files.every(f => f.status === 'removed')
36+
const touchesTooMany = files.length > 10
37+
38+
// Close the PR and add the invalid label
39+
if (onlyDeletes || touchesTooMany) {
40+
await github.rest.issues.update({
41+
owner: owner,
42+
repo: repo,
43+
issue_number: pull_number,
44+
labels: ['invalid'],
45+
});
46+
47+
// Comment on the PR
48+
await github.rest.issues.createComment({
49+
owner: owner,
50+
repo: repo,
51+
issue_number: pull_number,
52+
body: `This pull request may have been opened accidentally. I'm going to close it now, but feel free to check out our [contribution guidelines](https://docs.github.com/en/contributing), or raise a new issue.`
53+
});
54+
}

.github/workflows/link-check-internal.yml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,12 @@ jobs:
4747
# Manual run: use the provided version and language
4848
echo "matrix={\"include\":[{\"version\":\"${INPUT_VERSION}\",\"language\":\"${INPUT_LANGUAGE}\"}]}" >> $GITHUB_OUTPUT
4949
else
50-
# Scheduled run: English free-pro-team + English latest enterprise-server
51-
LATEST_GHES=$(npx tsx -e "import { latest } from './src/versions/lib/enterprise-server-releases'; console.log(latest)")
52-
echo "matrix={\"include\":[{\"version\":\"free-pro-team@latest\",\"language\":\"en\"},{\"version\":\"enterprise-server@${LATEST_GHES}\",\"language\":\"en\"}]}" >> $GITHUB_OUTPUT
50+
# Scheduled run: every published version, in English. A link can be broken in
51+
# one version and fine in another, so checking two of eight left most of the
52+
# site unchecked. The report job merges the results, so this does not multiply
53+
# the size of the issue.
54+
MATRIX=$(npx tsx -e "import { allVersions } from './src/versions/lib/all-versions'; console.log(JSON.stringify({ include: Object.keys(allVersions).map((version) => ({ version, language: 'en' })) }))")
55+
echo "matrix=${MATRIX}" >> $GITHUB_OUTPUT
5356
fi
5457
env:
5558
EVENT_NAME: ${{ github.event_name }}
@@ -245,6 +248,17 @@ jobs:
245248
echo "No broken link reports generated - all links valid!"
246249
fi
247250
251+
- name: Upload the combined report
252+
if: steps.combine.outputs.has_reports == 'true'
253+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
254+
with:
255+
# The issue body caps every long section, and the notes there point at
256+
# "the report attached to the workflow run". Upload it so that is true.
257+
name: combined-link-report
258+
path: combined-report.md
259+
retention-days: 5
260+
if-no-files-found: error
261+
248262
- name: Create or update the rolling report issue
249263
if: |
250264
steps.combine.outputs.has_reports == 'true'
@@ -268,7 +282,15 @@ jobs:
268282
let body = fs.readFileSync('combined-report.md', 'utf8')
269283
if (body.length > MAX_BODY_SIZE) {
270284
const notice = `\n\n---\n\n*Report truncated. Download the full report from the [workflow run artifacts](${runUrl}).*`
271-
body = body.slice(0, MAX_BODY_SIZE - notice.length) + notice
285+
let cut = body.slice(0, MAX_BODY_SIZE - notice.length)
286+
// Cut at a line boundary so the last thing a reader sees is not half
287+
// a table row, and close any `<details>` the cut left open, since an
288+
// unclosed one swallows everything after it.
289+
cut = cut.slice(0, cut.lastIndexOf('\n'))
290+
const opened = (cut.match(/<details>/g) || []).length
291+
const closed = (cut.match(/<\/details>/g) || []).length
292+
cut += '\n</details>'.repeat(Math.max(0, opened - closed))
293+
body = cut + notice
272294
core.warning(`Report exceeded ${MAX_BODY_SIZE} characters, so it was truncated.`)
273295
}
274296
350 KB
Loading

content/code-security/concepts/code-quality/code-quality.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ category:
2020

2121
{% data variables.product.prodname_code_quality %} analyzes your code for quality and coverage issues and delivers {% data variables.product.prodname_copilot_short %}-powered fixes you can apply in one click. It runs in two places:
2222

23-
* **On pull requests**, {% data variables.product.prodname_code_quality_short %} uses deterministic {% data variables.product.prodname_codeql %} rules to detect known anti-patterns and posts findings as inline comments before code is merged. If you upload a Cobertura XML coverage report, coverage metrics show whether a change maintains or reduces coverage. You can enforce quality and coverage thresholds with rulesets to block pull requests that don't meet your criteria, so new quality debt doesn't accumulate.
23+
* **On pull requests**, {% data variables.product.prodname_code_quality_short %} uses deterministic {% data variables.product.prodname_codeql %} rules to detect known anti-patterns and posts findings as inline comments before code is merged. If you upload a Cobertura XML coverage report, line coverage metrics show whether a change maintains or reduces coverage. You can enforce quality and coverage thresholds with rulesets to block pull requests that don't meet your criteria, so new quality debt doesn't accumulate.
2424
* **On the default branch**, rules-based scans identify existing quality debt across your codebase, with autofixes you can apply directly or assign to {% data variables.copilot.copilot_cloud_agent %} to resolve on your behalf. AI-powered analysis also runs on recently changed files, flagging issues that fall outside existing rule sets, including languages not yet covered by {% data variables.product.prodname_codeql %} queries.
2525

2626
> [!NOTE]
@@ -32,14 +32,14 @@ Here's what {% data variables.product.prodname_code_quality %} looks like in pra
3232

3333
For developers and teams:
3434

35-
* **A developer opens a pull request** that introduces a reliability or maintainability issue. {% data variables.product.prodname_code_quality_short %} posts a comment explaining the issue and offers a one-click fix before the code is merged. The developer also sees a report of coverage metrics, and can tell at a glance whether the pull request improves or reduces coverage compared to the default branch.
35+
* **A developer opens a pull request** that introduces a reliability or maintainability issue. {% data variables.product.prodname_code_quality_short %} posts a comment explaining the issue and offers a one-click fix before the code is merged. The developer also sees a report of line coverage metrics, and can tell at a glance whether the pull request improves or reduces coverage compared to the default branch.
3636
* **A team inherits a large codebase** with years of accumulated quality debt. {% data variables.product.prodname_code_quality_short %} scans the default branch, surfaces findings with autofixes on a dashboard, and the team assigns remediation work to {% data variables.copilot.copilot_cloud_agent %} to open fix pull requests automatically.
3737
* **A team adopts AI coding assistants** and needs assurance that generated code meets the same bar as hand-written code. AI-powered analysis catches issues in recently changed files that rule-based queries weren't written for, while {% data variables.product.prodname_codeql %} rules cover well-defined anti-patterns.
3838

3939
For administrators and leads:
4040

4141
* **An engineering lead sets coverage and quality thresholds** using rulesets. Pull requests that don't meet the criteria are blocked from merging, so no new quality or coverage debt accumulates.
42-
* **An administrator needs visibility across repositories** for audits or compliance reporting. {% data variables.product.prodname_code_quality_short %} reports through the security overview alongside security tools, so they can see quality posture across the organization at a glance, identify which repositories need attention, and track improvement metrics using standard {% data variables.product.github %} audit controls and policies.
42+
* **An administrator needs visibility across repositories** for audits or compliance reporting. {% data variables.product.prodname_code_quality_short %} reports through the security overview alongside security tools, so they can see current quality posture across the organization, review how open findings have changed over time, and identify which repositories need attention. See [AUTOTITLE](/code-security/how-tos/maintain-quality-code/explore-code-quality).
4343

4444
## Availability and billing
4545

content/code-security/how-tos/maintain-quality-code/explore-code-quality.md

Lines changed: 78 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,106 @@ redirect_from:
2222

2323
## Viewing code quality insights for your organization
2424

25+
The organization-level dashboard has two tabs:
26+
27+
* The **Health** tab shows a snapshot of your organization's current code health.
28+
* The **Trends** tab shows how open findings have changed over a selected period of time, so you can track progress and identify repositories that need attention.
29+
2530
1. On {% data variables.product.prodname_dotcom %}, navigate to the main page of your organization. For example, from [https://github.com/settings/organizations](https://github.com/settings/organizations?ref_product=github&ref_type=engagement&ref_style=text&utm_campaign=code-quality-ga-july-2026&utm_medium=docs&utm_source=docs-explore-cq-org-settings).
2631
{% data reusables.organizations.security-overview %}
27-
1. In the "Insights" section of the sidebar, click {% octicon "code-square" aria-hidden="true" aria-label="code-square" %} **Code quality**.
32+
1. In the "Insights" section of the sidebar, click **{% data variables.code-quality.code_quality_ui_settings %}**.
2833

2934
> [!NOTE]
3035
> What you see on the dashboard depends on your access:
36+
>
3137
> * Organization owners see data for **every** repository that has {% data variables.product.prodname_code_quality_short %} enabled.
3238
> * All other organization members see data only for repositories where they can view {% data variables.product.prodname_code_quality_short %} findings (the repository-level pages), up to a maximum of 3,000 repositories.
3339
34-
## Interpreting the score distribution chart
40+
## Filtering dashboard data
41+
42+
A filter bar at the top of the dashboard applies to both the **Health** and **Trends** tabs. You can filter by:
43+
44+
* Reliability score
45+
* Maintainability score
46+
* {% data variables.code-quality.all_findings %}
47+
* {% data variables.code-quality.recent_suggestions %}
48+
* Topic
49+
* Team
50+
* Visibility
51+
* Any custom properties defined for your organization
52+
53+
You can also sort the dashboard data using the **Sort** control in the same filter bar.
54+
55+
## Viewing current code health
56+
57+
The **Health** tab shows a snapshot of your organization's code health right now.
58+
59+
### Interpreting the score distribution chart
3560

3661
The score distribution chart provides a visual overview of the code health of your organization. Each bubble represents a collection of repositories with the same maintainability and reliability scores.
62+
3763
* The **position** of each bubble demonstrates the overall health of those repositories. Higher bubbles represent higher maintainability scores, while bubbles further to the right represent higher reliability scores.
3864
* The **color and border pattern** of a bubble indicate the severity of the lower score for those repositories. For example, a bubble with a "Poor" score in either category will always be red with a dashed border.
3965
* The **size** of each bubble represents the number of repositories with that particular score combination.
4066

4167
To view the maintainability score, reliability score, and number of repositories represented by a particular bubble, hover over the bubble.
4268

43-
## Exploring the repository table
69+
### Exploring the repository table
4470

4571
Below the bubble chart, there is a table that lists all repositories in your organization. Here, you can view code quality findings, along with more detailed information about those findings.
4672

4773
You can sort the repository table in ascending or descending order for any column by clicking the column header.
4874

49-
## Investigating low-scoring repositories
75+
### Investigating low-scoring repositories
5076

5177
1. To filter the dashboard data for the lowest-performing repositories, on the score distribution chart, click the bubble with the lowest combined scores.
5278
1. Scroll down to the repository table. By default, the table is sorted from most to least recent repository scan, helping you prioritize current quality issues.
53-
1. Optionally, to prioritize repositories with the highest number of {% data variables.product.prodname_codeql %} findings, click **Standard Findings** twice.
79+
1. Optionally, to prioritize repositories with the highest number of {% data variables.product.prodname_codeql %} findings, click **{% data variables.code-quality.all_findings %}** twice.
5480
1. To view the repository-level dashboard for a specific repository, click the repository's name.
81+
82+
## Tracking quality trends over time
83+
84+
The **Trends** tab shows how open findings across repositories that you have access to and that match the current filters have changed over time, so you can tell whether your code quality work is having an effect and where to focus attention next.
85+
86+
1. On the organization-level dashboard, click the **Trends** tab.
87+
1. Use the **Period** dropdown to select a time range: the last 7, 14, or 30 days.
88+
1. Review the "Open findings over time" graph, which shows the total number of open findings across applicable repositories for the selected period.
89+
1. Optionally, use the buttons above the graph to group the data by **Health score** or **Severity**.
90+
1. Hover over a point on the graph to see the open finding count for that day.
91+
92+
### Understanding the trends data
93+
94+
Keep the following in mind when you interpret the graph:
95+
96+
* The graph is based on daily snapshots of open findings. If no analysis ran on a given day, there may be no data point for that day.
97+
* Historical data is only available from when {% data variables.product.prodname_code_quality_short %} started taking snapshots, so the available time range may initially be limited.
98+
* The graph tracks the total count of open findings, not individual findings being opened or fixed. A change in the count doesn't necessarily mean developers fixed or introduced problems.
99+
* Enabling {% data variables.product.prodname_code_quality_short %} on additional repositories can increase the finding count shown in the graph. An increase after enabling new repositories doesn't necessarily mean code quality is declining.
100+
* The graph tracks the total count of open findings for the repositories you are currently filtering on. The total count includes:
101+
102+
* New findings that are introduced by code changes or when code quality analysis is enabled on new repositories
103+
* Findings that are fixed in the code or dismissed by users
104+
105+
## Identifying repositories that need attention
106+
107+
Below the trends graph, two tables help you identify which repositories need attention over the selected time period:
108+
109+
* **Most improved repositories** lists repositories with the largest decrease in open findings over the selected time period.
110+
* **Repositories needing improvement** lists repositories with the largest increase in open findings over the selected time period.
111+
112+
Both tables include the following columns:
113+
114+
* **Repository**: The name of the repository.
115+
* **Total open**: The number of open findings for the repository at the end of the selected time period.
116+
* **Net change**: How the open finding count for the repository has changed over the selected time period.
117+
* **Dismissed**: How many findings were dismissed for the repository over the selected time period.
118+
119+
The number of findings for a repository is affected by findings being fixed and dismissed. You can use the repository-level dashboard to confirm what changed.
120+
121+
To investigate a repository, click its name to open its repository-level {% data variables.product.prodname_code_quality_short %} dashboard, where you can review individual findings and take remediation action.
122+
123+
## Next steps
124+
125+
To understand the code health information available on the repository-level dashboard, see [AUTOTITLE](/code-security/how-tos/maintain-quality-code/interpret-results).
126+
127+
If you're planning to enable {% data variables.product.prodname_code_quality_short %} across many repositories, see [AUTOTITLE](/code-security/how-tos/maintain-quality-code/roll-out-at-scale).

content/code-security/how-tos/maintain-quality-code/restrict-code-coverage.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ category:
1919
* {% data variables.product.prodname_code_quality %} is enabled on the repository.
2020
* Code coverage data is uploaded to {% data variables.product.github %} for the pull request branch. See [AUTOTITLE](/code-security/how-tos/maintain-quality-code/set-up-code-coverage).
2121

22+
> [!NOTE]
23+
> Coverage thresholds are evaluated against **line coverage**. See [AUTOTITLE](/code-security/reference/code-quality/code-coverage).
24+
2225
## Creating a coverage threshold rule
2326

2427
{% data reusables.repositories.navigate-to-repo %}
@@ -28,8 +31,8 @@ category:
2831
1. Under "Branch rules", select **Restrict code coverage**.
2932
1. Expand **Additional settings** to configure thresholds. A value of 0 means that the threshold is disabled.
3033

31-
* **Minimum coverage percentage**: enter a value to block pull requests where aggregated coverage falls below this percentage.
32-
* **Maximum coverage drop**: enter a value to block pull requests where coverage drops by more than this many percentage points relative to the default branch.
34+
* **Minimum line coverage percentage**: enter a value to block pull requests where aggregated line coverage falls below this percentage.
35+
* **Maximum line coverage drop**: enter a value to block pull requests where line coverage drops by more than this many percentage points relative to the default branch.
3336

3437
1. Click **Create** or **Save changes**.
3538

content/code-security/how-tos/maintain-quality-code/set-pr-thresholds.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ You can block pull requests that don't meet your code quality standards by addin
2121
You can set thresholds for:
2222

2323
* **{% data variables.product.prodname_codeql %} findings**, by the lowest severity of results you require to be resolved.
24-
* **Code coverage**, by the minimum percentage of code that must be covered by tests.
24+
* **Code coverage**, by the minimum percentage of lines that must be covered by tests.
2525

2626
You can enforce these thresholds at the **repository** level, or at the **organization** level to apply the same standard across many repositories at once. Choose the organization level when you want a consistent quality bar across teams, and the repository level when a single project needs its own standard. {% data variables.product.prodname_code_quality_short %} {% data variables.code-quality.recent_suggestions %} cannot be set as a threshold.
2727

0 commit comments

Comments
 (0)