Skip to content

Commit

Permalink
Merge branch 'main' into runner-service-env
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenalex836 authored Dec 26, 2024
2 parents 7e13fcb + d25344a commit 4a450d1
Show file tree
Hide file tree
Showing 2,993 changed files with 124,030 additions and 61,854 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"cSpell.language": ",en"
"cSpell.language": ",en",
"git.autofetch": true
},
// Visual Studio Code extensions which help authoring for docs.github.com.
"extensions": [
Expand Down
9 changes: 4 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Thank you for contributing to this project! You must fill out the information be

### Why:

Closes:
Closes:

<!-- If there's an existing issue for your change, please link to it above.
If there's _not_ an existing issue, please open one first to make it more likely that this update will be accepted: https://github.com/github/docs/issues/new/choose. -->
Expand All @@ -16,7 +16,6 @@ If you made changes to the `content` directory, a table will populate in a comme

### Check off the following:

- [ ] I have reviewed my changes in staging, available via the **View deployment** link in this PR's timeline (this link will be available after opening the PR).

- For content changes, you will also see an automatically generated comment with links directly to pages you've modified. The comment won't appear if your PR only edits files in the `data` directory.
- [ ] For content changes, I have completed the [self-review checklist](https://docs.github.com/en/contributing/collaborating-on-github-docs/self-review-checklist).
- [ ] A subject matter expert (SME) has reviewed the technical accuracy of the content in this PR. In most cases, the author can be the SME. Open source contributions may require a SME review from GitHub staff.
- [ ] The changes in this PR meet [the docs fundamentals that are required for all content](http://docs.github.com/en/contributing/writing-for-github-docs/about-githubs-documentation-fundamentals).
- [ ] All CI checks are passing.
2 changes: 1 addition & 1 deletion .github/actions/get-docs-early-access/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ runs:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
GITHUB_TOKEN: ${{ inputs.token }}
shell: bash
run: node src/early-access/scripts/what-docs-early-access-branch.js
run: npm run what-docs-early-access-branch

- name: Clone
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/labeler/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ runs:
using: 'composite'
steps:
- name: Add label to an issue or pr
run: node .github/actions/labeler/labeler.js
run: npm run labeler
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.token }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
/* See function main in this file for documentation */

import coreLib from '@actions/core'

import github from '#src/workflows/github.js'
import { getActionContext } from '#src/workflows/action-context.js'
import { boolEnvVar } from '#src/workflows/get-env-inputs.js'
import { type Octokit } from '@octokit/rest'
import { CoreInject } from '@/links/scripts/action-injections'

import github from '#src/workflows/github.ts'
import { getActionContext } from '#src/workflows/action-context.ts'
import { boolEnvVar } from '#src/workflows/get-env-inputs.ts'

type Options = {
addLabels?: string[]
removeLabels?: string[]
ignoreIfAssigned?: boolean
ignoreIfLabeled?: boolean
issue_number?: number
owner?: string
repo?: string
}

// When this file is invoked directly from action as opposed to being imported
if (import.meta.url.endsWith(process.argv[1])) {
Expand All @@ -16,28 +28,19 @@ if (import.meta.url.endsWith(process.argv[1])) {

const octokit = github()

const opts = {
addLabels: ADD_LABELS,
removeLabels: REMOVE_LABELS,
const opts: Options = {
ignoreIfAssigned: boolEnvVar('IGNORE_IF_ASSIGNED'),
ignoreIfLabeled: boolEnvVar('IGNORE_IF_LABELED'),
}

// labels come in comma separated from actions
let addLabels

if (opts.addLabels) {
addLabels = [...opts.addLabels.split(',')]
opts.addLabels = addLabels.map((l) => l.trim())
if (typeof ADD_LABELS === 'string') {
opts.addLabels = [...ADD_LABELS.split(',')].map((l) => l.trim())
} else {
opts.addLabels = []
}

let removeLabels

if (opts.removeLabels) {
removeLabels = [...opts.removeLabels.split(',')]
opts.removeLabels = removeLabels.map((l) => l.trim())
if (typeof REMOVE_LABELS === 'string') {
opts.removeLabels = [...REMOVE_LABELS.split(',')].map((l) => l.trim())
} else {
opts.removeLabels = []
}
Expand All @@ -54,7 +57,7 @@ if (import.meta.url.endsWith(process.argv[1])) {
opts.owner = owner
opts.repo = repo

main(coreLib, octokit, opts, {})
main(coreLib, octokit, opts)
}

/*
Expand All @@ -69,22 +72,31 @@ if (import.meta.url.endsWith(process.argv[1])) {
* ignoreIfAssigned {boolean} don't apply labels if there are assignees
* ignoreIfLabeled {boolean} don't apply labels if there are already labels added
*/
export default async function main(core, octokit, opts = {}) {
export default async function main(
core: typeof coreLib | CoreInject,
octokit: Octokit,
opts: Options = {},
) {
if (opts.addLabels?.length === 0 && opts.removeLabels?.length === 0) {
core.info('No labels to add or remove specified, nothing to do.')
return
}

if (!opts.issue_number || !opts.owner || !opts.repo) {
throw new Error(`Missing required parameters ${JSON.stringify(opts)}`)
}
const issueOpts = {
issue_number: opts.issue_number,
owner: opts.owner,
repo: opts.repo,
}

if (opts.ignoreIfAssigned || opts.ignoreIfLabeled) {
try {
const { data } = await octokit.issues.get({
issue_number: opts.issue_number,
owner: opts.owner,
repo: opts.repo,
})
const { data } = await octokit.issues.get(issueOpts)

if (opts.ignoreIfAssigned) {
if (data.assignees.length > 0) {
if (data.assignees?.length) {
core.info(
`ignore-if-assigned is true: not applying labels since there's ${data.assignees.length} assignees`,
)
Expand All @@ -105,31 +117,24 @@ export default async function main(core, octokit, opts = {}) {
}
}

if (opts.removeLabels?.length > 0) {
if (opts.removeLabels?.length) {
// removing a label fails if the label isn't already applied
let appliedLabels = []

try {
const { data } = await octokit.issues.get({
issue_number: opts.issue_number,
owner: opts.owner,
repo: opts.repo,
})

appliedLabels = data.labels.map((l) => l.name)
const { data } = await octokit.issues.get(issueOpts)
appliedLabels = data.labels.map((l) => (typeof l === 'string' ? l : l.name))
} catch (err) {
throw new Error(`Error getting issue: ${err}`)
}

opts.removeLabels = opts.removeLabels.filter((l) => appliedLabels.includes(l))
opts.removeLabels = opts.removeLabels?.filter((l) => appliedLabels.includes(l))

await Promise.all(
opts.removeLabels.map(async (label) => {
try {
await octokit.issues.removeLabel({
issue_number: opts.issue_number,
owner: opts.owner,
repo: opts.repo,
...issueOpts,
name: label,
})
} catch (err) {
Expand All @@ -138,17 +143,15 @@ export default async function main(core, octokit, opts = {}) {
}),
)

if (opts.removeLabels.length > 0) {
if (opts.removeLabels?.length) {
core.info(`Removed labels: ${opts.removeLabels.join(', ')}`)
}
}

if (opts.addLabels?.length > 0) {
if (opts.addLabels?.length) {
try {
await octokit.issues.addLabels({
issue_number: opts.issue_number,
owner: opts.owner,
repo: opts.repo,
...issueOpts,
labels: opts.addLabels,
})

Expand Down
2 changes: 1 addition & 1 deletion .github/actions/warmup-remotejson-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ runs:
- name: Run script
if: ${{ inputs.restore-only == '' }}
shell: bash
run: node src/archives/scripts/warmup-remotejson.js
run: npm run warmup-remotejson

- name: Cache .remotejson-cache (save)
if: ${{ inputs.restore-only == '' }}
Expand Down
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
version: 2
registries:
ghcr: # Define access for a private registry
type: docker-registry
url: ghcr.io
username: PAT
password: ${{secrets.CONTAINER_BUILDER_TOKEN}}
updates:
- package-ecosystem: npm
directory: '/'
Expand All @@ -23,11 +29,18 @@ updates:
- dependency-name: '*'
update-types:
['version-update:semver-patch', 'version-update:semver-minor']
- dependency-name: 'github/internal-actions'

- package-ecosystem: 'docker'
registries:
- ghcr
directory: '/'
schedule:
interval: weekly
day: thursday
groups:
baseImages:
patterns:
- '*'
ignore:
- dependency-name: 'node'
36 changes: 0 additions & 36 deletions .github/review-template.md

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/add-review-template.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/azure-preview-env-deploy-public.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ jobs:
uses: docker/build-push-action@16ebe778df0e7752d2cfcbd924afdbbd89c1a755
with:
context: .
file: Dockerfile.azure
push: true
target: preview
tags: ${{ env.DOCKER_IMAGE }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/azure-preview-env-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ jobs:
uses: docker/build-push-action@16ebe778df0e7752d2cfcbd924afdbbd89c1a755
with:
context: .
file: Dockerfile.azure
push: true
target: ${{ steps.with-translations.outputs.result == 'true' && 'production' || 'preview' }}
tags: ${{ env.DOCKER_IMAGE }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/azure-prod-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ jobs:
uses: docker/build-push-action@16ebe778df0e7752d2cfcbd924afdbbd89c1a755
with:
context: .
file: Dockerfile.azure
push: true
target: production
tags: ${{ env.DOCKER_IMAGE }}, ${{ env.DOCKER_IMAGE_CACHE_REF }}
Expand All @@ -126,7 +127,7 @@ jobs:
CHECK_INTERVAL: 10000
EXPECTED_SHA: ${{ github.sha }}
CANARY_BUILD_URL: https://ghdocs-prod-canary.azurewebsites.net/_build
run: src/workflows/check-canary-slots.js
run: npm run check-canary-slots

- name: 'Swap canary slot to production'
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/azure-staging-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
uses: docker/build-push-action@16ebe778df0e7752d2cfcbd924afdbbd89c1a755
with:
context: .
file: Dockerfile.azure
push: true
target: production
tags: ${{ env.DOCKER_IMAGE }}
Expand All @@ -114,7 +115,7 @@ jobs:
CHECK_INTERVAL: 10000
EXPECTED_SHA: ${{ github.sha }}
CANARY_BUILD_URL: https://ghdocs-staging-canary.azurewebsites.net/_build
run: src/workflows/check-canary-slots.js
run: npm run check-canary-slots

- name: 'Swap deployment slot to production'
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/comment-release-note-info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
Thank you for updating our GitHub Enterprise Server release notes. A member of the `docs-content-enterprise` team will review your changes.
Thank you for updating our GitHub Enterprise Server release notes. Please request a technical review for your changes. Once the technical review is complete, a member of the `docs-content-enterprise` team will review your changes.
- If the change is urgent, post in `#docs-content-enterprise` on Slack.
- Review the [style guide for release notes](https://docs.github.com/en/contributing/style-guide-and-content-model/style-guide#release-notes).
- If you're updating or adding a note, add a datestamp in the format `[Updated: YYYY-MM-DD]`.
- If you're removing a note, add an "[Errata](https://docs.github.com/en/contributing/style-guide-and-content-model/style-guide#errata)" section with details of the change.
- If you're removing a note, add an [Errata](https://docs.github.com/en/contributing/style-guide-and-content-model/style-guide#errata) section with details of the change.
Loading

0 comments on commit 4a450d1

Please sign in to comment.