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
35 changes: 15 additions & 20 deletions .github/workflows/content-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ jobs:
fi

- name: Run content pipeline update script
id: update
env:
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -128,32 +127,31 @@ jobs:
git push origin "$UPDATE_BRANCH"
fi

- name: Read source repo info from config
id: source-info
env:
PIPELINE_ID: ${{ matrix.id }}
run: |
SOURCE_REPO=$(yq -r ".[\"${PIPELINE_ID}\"].\"source-repo\"" src/content-pipelines/config.yml)
SOURCE_PATH=$(yq -r ".[\"${PIPELINE_ID}\"].\"source-path\"" src/content-pipelines/config.yml)
echo "source_repo=$SOURCE_REPO" >> "$GITHUB_OUTPUT"
echo "source_path=$SOURCE_PATH" >> "$GITHUB_OUTPUT"

- name: Create or update PR
if: steps.commit.outputs.has_changes == 'true'
env:
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }}
UPDATE_BRANCH: ${{ steps.branch.outputs.update_branch }}
PIPELINE_ID: ${{ matrix.id }}
COMPARE_URL: ${{ steps.update.outputs.compare_url }}
SHORT_RANGE: ${{ steps.update.outputs.short_range }}
SOURCE_REPO: ${{ steps.source-info.outputs.source_repo }}
SOURCE_PATH: ${{ steps.source-info.outputs.source_path }}
run: |
PR_NUMBER="${{ steps.check-pr.outputs.pr_number }}"
PR_TITLE="docs: update ${PIPELINE_ID} content from source docs"
NEW_ITEM="* [\`${SHORT_RANGE}\`](${COMPARE_URL})"
SOURCE_LINK="See the [upstream repo](https://github.com/${SOURCE_REPO}/tree/main/${SOURCE_PATH}) for changes that triggered this update."

if [ -n "$PR_NUMBER" ]; then
echo "PR #$PR_NUMBER already exists — appending source changes to body"

EXISTING_BODY=$(gh pr view "$PR_NUMBER" --json body --jq '.body')

# Append a new bullet before the SOURCE_CHANGES end marker
# Uses bash parameter expansion for safe literal string replacement
MARKER="<!-- /SOURCE_CHANGES -->"
INSERTION="${NEW_ITEM}"$'\n'
INSERTION+="${MARKER}"
UPDATED_BODY="${EXISTING_BODY/$MARKER/$INSERTION}"

gh pr edit "$PR_NUMBER" --body "$UPDATED_BODY"
echo "PR #$PR_NUMBER already exists"

echo "Ensuring PR #$PR_NUMBER is marked ready for review"
gh pr ready "$PR_NUMBER" || echo "Unable to mark PR #$PR_NUMBER as ready (it may already be ready)"
Expand All @@ -166,10 +164,7 @@ jobs:
PR_BODY+="## What this does"$'\n\n'
PR_BODY+="Runs the \`content-pipeline-update\` agent (${PIPELINE_ID}) against the latest source docs and updates official articles under \`content/\` that have fallen out of sync."$'\n\n'
PR_BODY+="## Source changes"$'\n\n'
PR_BODY+="Changes in the source repo that triggered this update:"$'\n\n'
PR_BODY+="<!-- SOURCE_CHANGES -->"$'\n'
PR_BODY+="${NEW_ITEM}"$'\n'
PR_BODY+="<!-- /SOURCE_CHANGES -->"$'\n\n'
PR_BODY+="${SOURCE_LINK}"$'\n\n'
PR_BODY+="## Review"$'\n\n'
PR_BODY+="* Review each commit for accuracy — the agent uses AI, so spot-check important changes"$'\n'
PR_BODY+="* To adjust agent behavior, see [Modifying results](${{ github.server_url }}/${{ github.repository }}/blob/main/src/content-pipelines/README.md#modifying-results)"$'\n'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate-openapi-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0

- name: Build Docker image
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ If you have questions about this list, please contact us at <privacy@github.com>
| OpenAI | AI Inference and AI Services | United States | United States |
| Oracle America, Inc. | Cloud Hosted Infrastructure | United States | United States |
| Pusher | Building and managing real-time infrastructure for web and mobile applications | United States | United States |
| Tines Automation Inc. | Security management | United States | United States |
| Twilio (SendGrid) | SMS notification provider for 2 Factor Authentication | United States | United States |
| xAI | AI Inference and AI Services | United States | United States |
| Zendesk | Customer support ticketing system | United States | United States |
Expand Down
1 change: 1 addition & 0 deletions data/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ header:
' is currently available as a <a href="/admin/overview/about-upgrades-to-new-releases">release candidate</a>.'
early_access: 📣 Please <b>do not share</b> this URL publicly. This page contains content about a private preview feature.
release_notes_use_latest: Please use the latest release for the latest security, performance, and bug fixes.
machine_translation: Some of this page may have been machine-translated or translated using AI.
# GHES release notes
ghes_release_notes_upgrade_patch_only: 📣 This is not the <a href="#{{ latestPatch }}">latest patch release</a> of Enterprise Server.
ghes_release_notes_upgrade_release_only: 📣 This is not the <a href="/enterprise-server@{{ latestRelease }}/admin/release-notes">latest release</a> of Enterprise Server.
Expand Down
75 changes: 35 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
"escape-string-regexp": "5.0.0",
"express": "^5.2.1",
"fastest-levenshtein": "1.0.16",
"file-type": "21.0.0",
"file-type": "21.3.1",
"flat": "^6.0.1",
"github-slugger": "^2.0.0",
"glob": "13.0.2",
Expand Down
17 changes: 0 additions & 17 deletions src/content-pipelines/scripts/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,23 +325,6 @@ async function main(): Promise<void> {
console.log(`\nUpdated ${SHA_FILE} to ${currentSha}`)
}

// ---- Write source change metadata to $GITHUB_OUTPUT ----
// The workflow uses these values to populate the PR body with reviewer breadcrumbs.
const ghOutput = process.env.GITHUB_OUTPUT
if (ghOutput) {
const compareUrl = storedSha
? `https://github.com/${SOURCE_REPO}/compare/${storedSha}...${currentSha}`
: `https://github.com/${SOURCE_REPO}/commit/${currentSha}`
const shortRange = storedSha
? `${storedSha.slice(0, 7)}...${currentSha.slice(0, 7)}`
: currentSha.slice(0, 7)

const outputLines = [`compare_url=${compareUrl}`, `short_range=${shortRange}`]

fs.appendFileSync(ghOutput, `${outputLines.join('\n')}\n`)
console.log('Wrote source change metadata to $GITHUB_OUTPUT')
}

console.log('Done.')
}

Expand Down
1 change: 1 addition & 0 deletions src/fixtures/fixtures/data/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ header:
' is currently available as a <a href="/admin/overview/about-upgrades-to-new-releases">release candidate</a>.'
early_access: 📣 Please <b>do not share</b> this URL publicly. This page contains content about a private preview feature.
release_notes_use_latest: Please use the latest release for the latest security, performance, and bug fixes.
machine_translation: Some of this page may have been machine-translated or translated using AI.
# GHES release notes
ghes_release_notes_upgrade_patch_only: 📣 This is not the <a href="#{{ latestPatch }}">latest patch release</a> of Enterprise Server.
ghes_release_notes_upgrade_release_only: 📣 This is not the <a href="/enterprise-server@{{ latestRelease }}/admin/release-notes">latest release</a> of Enterprise Server.
Expand Down
27 changes: 26 additions & 1 deletion src/frame/components/page-header/HeaderNotifications.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect } from 'react'
import { useEffect, useState } from 'react'
import { useRouter } from 'next/router'
import cx from 'classnames'
import { XIcon } from '@primer/octicons-react'
Expand All @@ -11,11 +11,14 @@ import { useVersion } from '@/versions/components/useVersion'
import { useUserLanguage } from '@/languages/components/useUserLanguage'
import styles from './HeaderNotifications.module.scss'
import { useSharedUIContext } from '@/frame/components/context/SharedUIContext'
import Cookies from '@/frame/components/lib/cookies'
import { MACHINE_TRANSLATION_BANNER_COOKIE_NAME } from '@/frame/lib/constants'

enum NotificationType {
RELEASE = 'RELEASE',
TRANSLATION = 'TRANSLATION',
EARLY_ACCESS = 'EARLY_ACCESS',
MACHINE_TRANSLATION = 'MACHINE_TRANSLATION',
}

type Notif = {
Expand All @@ -36,6 +39,11 @@ export const HeaderNotifications = () => {

const { t } = useTranslation('header')

const [machineTranslationDismissed, setMachineTranslationDismissed] = useState(true)
useEffect(() => {
setMachineTranslationDismissed(Cookies.get(MACHINE_TRANSLATION_BANNER_COOKIE_NAME) === 'true')
}, [])

const translationNotices: Array<Notif> = []
if (router.locale === 'en') {
if (userLanguage && userLanguage !== 'en' && languages[userLanguage]) {
Expand All @@ -61,6 +69,22 @@ export const HeaderNotifications = () => {
})
}
}

if (router.locale !== 'en' && !machineTranslationDismissed) {
translationNotices.push({
type: NotificationType.MACHINE_TRANSLATION,
content: t('notices.machine_translation'),
onClose: () => {
setMachineTranslationDismissed(true)
try {
Cookies.set(MACHINE_TRANSLATION_BANNER_COOKIE_NAME, 'true')
} catch (err) {
console.warn('Unable to set cookie', err)
}
},
})
}

const releaseNotices: Array<Notif> = []
if (currentVersion === data.variables.release_candidate.version) {
releaseNotices.push({
Expand Down Expand Up @@ -100,6 +124,7 @@ export const HeaderNotifications = () => {
styles.container,
'text-center f5 color-fg-default py-4 px-6 z-1',
type === NotificationType.TRANSLATION && 'color-bg-accent',
type === NotificationType.MACHINE_TRANSLATION && 'color-bg-accent',
type === NotificationType.RELEASE && 'color-bg-accent',
type === NotificationType.EARLY_ACCESS && 'color-bg-danger',
!isLast && 'border-bottom color-border-default',
Expand Down
1 change: 1 addition & 0 deletions src/frame/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const DEFAULT_MAX_REQUEST_TIMEOUT = isDev ? 15_000 : 10_000

export const ROOT = process.env.ROOT || '.'
export const USER_LANGUAGE_COOKIE_NAME = 'user_language'
export const MACHINE_TRANSLATION_BANNER_COOKIE_NAME = 'machine_translation_banner_seen'
export const USER_VERSION_COOKIE_NAME = 'user_version'
export const TRANSLATIONS_ROOT = process.env.TRANSLATIONS_ROOT || 'translations'
export const MAX_REQUEST_TIMEOUT = process.env.REQUEST_TIMEOUT
Expand Down
Loading