Skip to content
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

Repo sync #35387

Merged
merged 2 commits into from
Nov 21, 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
5 changes: 5 additions & 0 deletions data/features/dependabot-updates-composerv1-closing-down.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Reference: Issue #15951 - Deprecation notice - Dependabot updates ceases supporting Composer v1 [Deprecation]
versions:
fpt: '*'
ghec: '*'
ghes: '>= 3.15'
2 changes: 1 addition & 1 deletion data/reusables/dependabot/supported-package-managers.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package manager | YAML value | Supported versions | Version updates | Secur
---------------|------------------|------------------|:---:|:---:|:---:|:---:|:---:|
Bundler | `bundler` | {% ifversion ghes < 3.15 %}v1, {% endif %}v2 | {% octicon "x" aria-label="Not supported" %}| {% octicon "check" aria-label="Supported" %} | {% octicon "check" aria-label="Supported" %} |
[Cargo](#cargo) | `cargo` | v1 | {% octicon "check" aria-label="Supported" %} | {% octicon "check" aria-label="Supported" %} | {% octicon "check" aria-label="Supported" %} | {% octicon "check" aria-label="Supported" %}{% ifversion dependabot-updates-cargo-private-registry-support %}{% else %} (Git only){% endif %} | {% octicon "x" aria-label="Not supported" %} |
Composer | `composer` | v1, v2 | {% octicon "check" aria-label="Supported" %} | {% octicon "check" aria-label="Supported" %} | {% octicon "check" aria-label="Supported" %} | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} |
Composer | `composer` | {% ifversion dependabot-updates-composerv1-closing-down %}v2{% else %}v1, v2{% endif %} | {% octicon "check" aria-label="Supported" %} | {% octicon "check" aria-label="Supported" %} | {% octicon "check" aria-label="Supported" %} | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} |
| {% ifversion dependabot-version-updates-devcontainer-support %} |
[Dev containers](#dev-containers) | `devcontainers` | Not applicable | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} | {% octicon "x" aria-label="Not supported" %} | {% octicon "x" aria-label="Not supported" %} | {% octicon "x" aria-label="Not supported" %} |
| {% endif %} |
Expand Down
5 changes: 5 additions & 0 deletions src/audit-logs/data/fpt/organization.json
Original file line number Diff line number Diff line change
Expand Up @@ -2959,6 +2959,11 @@
"description": "Changes were pushed to update and resolve a Dependabot alert in a project dependency.",
"docs_reference_links": "N/A"
},
{
"action": "repository_vulnerability_alert.withdraw",
"description": "A Dependabot alert was withdrawn.",
"docs_reference_links": "N/A"
},
{
"action": "repository_vulnerability_alerts.authorized_users_teams",
"description": "The list of people or teams authorized to receive Dependabot alerts for the repository was updated.",
Expand Down
5 changes: 5 additions & 0 deletions src/audit-logs/data/ghec/enterprise.json
Original file line number Diff line number Diff line change
Expand Up @@ -3734,6 +3734,11 @@
"description": "Changes were pushed to update and resolve a Dependabot alert in a project dependency.",
"docs_reference_links": "N/A"
},
{
"action": "repository_vulnerability_alert.withdraw",
"description": "A Dependabot alert was withdrawn.",
"docs_reference_links": "N/A"
},
{
"action": "repository_vulnerability_alerts.authorized_users_teams",
"description": "The list of people or teams authorized to receive Dependabot alerts for the repository was updated.",
Expand Down
5 changes: 5 additions & 0 deletions src/audit-logs/data/ghec/organization.json
Original file line number Diff line number Diff line change
Expand Up @@ -2959,6 +2959,11 @@
"description": "Changes were pushed to update and resolve a Dependabot alert in a project dependency.",
"docs_reference_links": "N/A"
},
{
"action": "repository_vulnerability_alert.withdraw",
"description": "A Dependabot alert was withdrawn.",
"docs_reference_links": "N/A"
},
{
"action": "repository_vulnerability_alerts.authorized_users_teams",
"description": "The list of people or teams authorized to receive Dependabot alerts for the repository was updated.",
Expand Down
2 changes: 1 addition & 1 deletion src/audit-logs/lib/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"apiOnlyEvents": "This event is not available in the web interface, only via the REST API, audit log streaming, or JSON/CSV exports.",
"apiRequestEvent": "This event is only available via audit log streaming."
},
"sha": "249a94280792ff9977d58a0541a322e5c4dd5763"
"sha": "014cf4c9c23bf1f27dd034a2a76b92388951c01c"
}
3 changes: 3 additions & 0 deletions src/search/lib/elasticsearch-versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ export const versionToIndexVersionMap: { [key: string]: string } = {}
// For each potential input (from request query string, CLI, etc), map it to the appropriate index version
for (const versionSource of Object.values(allVersions)) {
if (versionSource.hasNumberedReleases) {
// Map version number to corresponding release, e.g. `3.14` -> `ghes-3.14`
versionToIndexVersionMap[versionSource.currentRelease] = versionSource.miscVersionName
// Map full release name to corresponding release, e.g. `[email protected]` -> `ghes-3.14`
versionToIndexVersionMap[versionSource.version] = versionSource.miscVersionName
// Map shortname or plan, e.g. `ghes` or `enterprise-server` to the latest release, e.g. `ghes-3.14`
if (versionSource.latestRelease === versionSource.currentRelease) {
versionToIndexVersionMap[versionSource.plan] = versionSource.miscVersionName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ import {
ValidationError,
getSearchRequestParamsObject,
} from '@/search/lib/search-request-params/search-params-objects'
import {
getGeneralSearchIndexVersion,
getGeneralSearchIndexPrefix,
isBeforeSearchIndexMigration,
} from '@/search/lib/helpers/old-version-logic'

import type {
ComputedSearchQueryParams,
Expand Down Expand Up @@ -79,17 +74,8 @@ export function getSearchFromRequestParams<Type extends SearchTypes>(

let indexName = ''
if (!validationErrors.length) {
// generalSearch is the only type of search that uses the old index prefix logic, rather than the `getElasticSearchIndex` function logic
if (type === 'generalSearch' && isBeforeSearchIndexMigration()) {
indexName = `${getGeneralSearchIndexPrefix()}github-docs-${getGeneralSearchIndexVersion(searchParams.version)}-${searchParams.language}`
} else {
const getIndexResults = getElasticSearchIndex(
type,
searchParams.version,
searchParams.language,
)
indexName = getIndexResults.indexName
}
const getIndexResults = getElasticSearchIndex(type, searchParams.version, searchParams.language)
indexName = getIndexResults.indexName
}

return { indexName, searchParams, validationErrors }
Expand Down
12 changes: 0 additions & 12 deletions src/search/lib/search-request-params/search-params-objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import languages from '@/languages/lib/languages'
import { allIndexVersionKeys, versionToIndexVersionMap } from '@/search/lib/elasticsearch-versions'
import { SearchTypes } from '@/search/types'
import { versionAliases } from '@/search/lib/helpers/old-version-logic'
import { allVersions } from '@/versions/lib/all-versions'

import type { SearchRequestQueryParams } from '@/search/lib/search-request-params/types'

Expand Down Expand Up @@ -60,16 +58,6 @@ const SHARED_PARAMS_OBJ: SearchRequestQueryParams[] = [
const GENERAL_SEARCH_PARAMS_OBJ: SearchRequestQueryParams[] = [
...SHARED_PARAMS_OBJ,
{ key: 'query' },
// TODO: Overwrite with old version logic for now
{
key: 'version',
default_: 'dotcom',
validate: (v) => {
if (versionAliases[v] || allVersions[v]) return true
const valid = [...Object.keys(versionAliases), ...Object.keys(allVersions)]
throw new ValidationError(`'${v}' not in ${valid}`)
},
},
{ key: 'language', default_: 'en', validate: (v) => v in languages },
{
key: 'size',
Expand Down
8 changes: 7 additions & 1 deletion src/search/scripts/scrape/lib/search-index-records.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import path from 'path'
import fsSync from 'fs'
import fs from 'fs/promises'
import assert from 'assert'
import { isArray, isString } from 'lodash-es'
Expand All @@ -15,8 +16,13 @@ export async function writeIndexRecords(
const recordsObject = Object.fromEntries(records.map((record) => [record.objectID, record]))
const content = JSON.stringify(recordsObject, undefined, 0)

// If the outDirectory doesn't exist, create it
if (!fsSync.existsSync(outDirectory)) {
await fs.mkdir(outDirectory, { recursive: true })
}

const filePath = path.join(outDirectory, `${name}-records.json`)
await fs.writeFile(filePath, content)
await fs.writeFile(filePath, content, { flag: 'w' })

return filePath
}
Expand Down
6 changes: 3 additions & 3 deletions src/workflows/purge-old-workflow-runs.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* For every run found, it deletes its logs and its run.
*
* The total number of deletions is limited by the `MAX_DELETIONS`
* environment variable. The default is 2000.
* environment variable. The default is 500.
* */

import fs from 'fs'
Expand All @@ -29,7 +29,7 @@ import { getOctokit } from '@actions/github'
main()
async function main() {
const DRY_RUN = Boolean(JSON.parse(process.env.DRY_RUN || 'false'))
const MAX_DELETIONS = parseInt(JSON.parse(process.env.MAX_DELETIONS || '2000'))
const MAX_DELETIONS = parseInt(JSON.parse(process.env.MAX_DELETIONS || '500'))
const MIN_AGE_DAYS = parseInt(process.env.MIN_AGE_DAYS || '90', 10)

const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/')
Expand Down Expand Up @@ -134,7 +134,7 @@ async function deleteWorkflowRuns(
owner,
repo,
workflow,
{ dryRun = false, minAgeDays = 90, maxDeletions = 2000 },
{ dryRun = false, minAgeDays = 90, maxDeletions = 500 },
) {
// https://docs.github.com/en/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax#query-for-dates
const minCreated = new Date(Date.now() - minAgeDays * 24 * 60 * 60 * 1000)
Expand Down
Loading