Skip to content
Open
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
10 changes: 6 additions & 4 deletions .github/workflows/bump_private_action_runner_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
pull-requests: write # Action creates a PR.
runs-on: ubuntu-latest
name: Find latest private action runner version
env:
HUGO_ROOT: 'hugo/' # TODO: Remove once HUGO_DIR repo var is set; replace with ${{ vars.HUGO_DIR && format('{0}/', vars.HUGO_DIR) || '' }}
steps:
- uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3
id: octo-sts
Expand All @@ -31,14 +33,14 @@ jobs:
- name: Find and write latest version
id: write-version
run: |
python local/bin/py/version_getter.py \
python ${HUGO_ROOT}local/bin/py/version_getter.py \
--url "https://api.datadoghq.com/api/v2/on-prem-management-service/runner/latest-image" \
--file-name "private_action_runner_version.json"

- name: Save modified file
run: |
mkdir -p $RUNNER_TEMP/temp
cp ./data/private_action_runner_version.json $RUNNER_TEMP/temp/
cp ./${HUGO_ROOT}data/private_action_runner_version.json $RUNNER_TEMP/temp/

- name: echo new version
run: echo ${{ steps.write-version.outputs.new_version }}
Expand All @@ -49,14 +51,14 @@ jobs:

- name: Restore modified file
run: |
cp $RUNNER_TEMP/temp/private_action_runner_version.json ./data/
cp $RUNNER_TEMP/temp/private_action_runner_version.json ./${HUGO_ROOT}data/

- name: Write version
if: steps.write-version.outputs.new_version == 'true'
run: |-
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add ./data/private_action_runner_version.json
git add ./${HUGO_ROOT}data/private_action_runner_version.json
git commit -m "(Automated) Bump private action runner version"
git push -f origin HEAD:refs/heads/automatic-version-update/private-action-runner

Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/bump_synthetics_worker_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
pull-requests: write # Action creates a PR.
runs-on: ubuntu-latest
name: Find latest synthetics-worker version
env:
HUGO_ROOT: 'hugo/' # TODO: Remove once HUGO_DIR repo var is set; replace with ${{ vars.HUGO_DIR && format('{0}/', vars.HUGO_DIR) || '' }}
steps:
- uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3
id: octo-sts
Expand All @@ -31,14 +33,14 @@ jobs:
- name: Find and write latest version
id: write-version
run: |
python local/bin/py/version_getter.py \
python ${HUGO_ROOT}local/bin/py/version_getter.py \
--url "https://ddsynthetics-windows.s3.amazonaws.com/installers.json" \
--file-name "synthetics_worker_versions.json"

- name: Save modified file
run: |
mkdir -p $RUNNER_TEMP/temp
cp ./data/synthetics_worker_versions.json $RUNNER_TEMP/temp/
cp ./${HUGO_ROOT}data/synthetics_worker_versions.json $RUNNER_TEMP/temp/

- name: echo new version
run: echo ${{ steps.write-version.outputs.new_version }}
Expand All @@ -49,14 +51,14 @@ jobs:

- name: Restore modified file
run: |
cp $RUNNER_TEMP/temp/synthetics_worker_versions.json ./data/
cp $RUNNER_TEMP/temp/synthetics_worker_versions.json ./${HUGO_ROOT}data/

- name: Write version
if: steps.write-version.outputs.new_version == 'true'
run: |-
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add ./data/synthetics_worker_versions.json
git add ./${HUGO_ROOT}data/synthetics_worker_versions.json
git commit -m "(Automated) Bump synthetic worker version"
git push -f origin HEAD:refs/heads/automatic-version-update/synthetics-worker

Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/bump_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
id-token: write # Needed to federate tokens.

runs-on: ubuntu-latest
env:
HUGO_ROOT: 'hugo/' # TODO: Remove once HUGO_DIR repo var is set; replace with ${{ vars.HUGO_DIR && format('{0}/', vars.HUGO_DIR) || '' }}
steps:
- uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3
id: octo-sts
Expand Down Expand Up @@ -49,9 +51,9 @@ jobs:
- name: Write version
id: write-version
run: |-
mkdir -p ./data
echo '${{steps.set-versions.outputs.result}}' > ./data/sdk_versions.json
git add ./data/sdk_versions.json
mkdir -p ./${HUGO_ROOT}data
echo '${{steps.set-versions.outputs.result}}' > ./${HUGO_ROOT}data/sdk_versions.json
git add ./${HUGO_ROOT}data/sdk_versions.json
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/preview_link.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
pull_request:
paths:
- 'content/en/**.md'
- 'hugo/content/en/**.md'

permissions:
contents: read
Expand All @@ -17,6 +18,8 @@ jobs:
preview-link:
if: contains(github.head_ref, '/')
runs-on: ubuntu-latest
env:
HUGO_ROOT: 'hugo/' # TODO: Remove once HUGO_DIR repo var is set; replace with ${{ vars.HUGO_DIR && format('{0}/', vars.HUGO_DIR) || '' }}
steps:
- name: Checkout
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
Expand Down Expand Up @@ -64,7 +67,7 @@ jobs:
ADDED_FILES: ${{ steps.changed_files.outputs.added_files }}
id: comment_body
run: |
python local/bin/py/preview_links.py --deleted="${DELETED_FILES}" \
python ${HUGO_ROOT}local/bin/py/preview_links.py --deleted="${DELETED_FILES}" \
--renamed="${RENAMED_FILES}" \
--modified="${MODIFIED_FILES}" \
--added="${ADDED_FILES}"
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/site_region_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
paths:
- 'content/en/**/*.md'
- 'hugo/content/en/**/*.md'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
Expand All @@ -17,6 +18,8 @@ jobs:
check-site-region:
if: github.head_ref != 'guacbot/translation-pipeline'
runs-on: ubuntu-latest
env:
HUGO_ROOT: 'hugo/' # TODO: Remove once HUGO_DIR repo var is set; replace with ${{ vars.HUGO_DIR && format('{0}/', vars.HUGO_DIR) || '' }}
steps:
- name: Checkout code
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
Expand All @@ -27,7 +30,7 @@ jobs:
- name: Get changed markdown files
id: changed_files
run: |
FILES=$(git diff --diff-filter=AMD --name-only ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} -- 'content/en/**/*.md' | xargs)
FILES=$(git diff --diff-filter=AMD --name-only ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} -- "${HUGO_ROOT}content/en/**/*.md" | xargs)
echo "files=$FILES" >> $GITHUB_OUTPUT

- name: Check for site-region at top of page with support language
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/vale_linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ on:
pull_request:
paths:
- 'content/en/**/*'
- 'hugo/content/en/**/*'
- 'layouts/shortcodes/**/*.md'
- 'hugo/layouts/shortcodes/**/*.md'
- '!**/*.json'

permissions:
Expand All @@ -18,6 +20,8 @@ jobs:
vale:
runs-on: ubuntu-latest
timeout-minutes: 5
env:
HUGO_ROOT: 'hugo/' # TODO: Remove once HUGO_DIR repo var is set; replace with ${{ vars.HUGO_DIR && format('{0}/', vars.HUGO_DIR) || '' }}
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
with:
Expand Down Expand Up @@ -50,12 +54,12 @@ jobs:
CHANGED_FILES: ${{ steps.changed_lines.outputs.changed_files }}
run: |
vale "${CHANGED_FILES}" \
--output=local/bin/py/vale/vale_template.tmpl --no-exit > vale_output.log
--output=${HUGO_ROOT}local/bin/py/vale/vale_template.tmpl --no-exit > vale_output.log

- name: Parse Vale output
if: steps.changed_lines.outputs.changed_files
env:
CHANGED_LINES: ${{ steps.changed_lines.outputs.changed_lines }}
run: |
python local/bin/py/vale/vale_annotations.py \
python ${HUGO_ROOT}local/bin/py/vale/vale_annotations.py \
--git_data="${CHANGED_LINES}"
10 changes: 6 additions & 4 deletions .github/workflows/version_getter_shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
id-token: write # Needed to federate tokens.
runs-on: ubuntu-latest
name: Find latest version
env:
HUGO_ROOT: 'hugo/' # TODO: Remove once HUGO_DIR repo var is set; replace with ${{ vars.HUGO_DIR && format('{0}/', vars.HUGO_DIR) || '' }}
steps:
- uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3
id: octo-sts
Expand All @@ -39,12 +41,12 @@ jobs:
- name: Find and write latest version
id: write-version
run: |
python local/bin/py/version_getter.py --url ${{ inputs.url }} --file-name ${{ inputs.file_name }}
python ${HUGO_ROOT}local/bin/py/version_getter.py --url ${{ inputs.url }} --file-name ${{ inputs.file_name }}

- name: Save modified file
run: |
mkdir -p $RUNNER_TEMP/temp
cp ./data/{{ inputs.file_name }} $RUNNER_TEMP/temp/
cp ./${HUGO_ROOT}data/{{ inputs.file_name }} $RUNNER_TEMP/temp/

- name: echo new version
run: echo ${{ steps.write-version.outputs.new_version }}
Expand All @@ -55,14 +57,14 @@ jobs:

- name: Restore modified file
run: |
cp $RUNNER_TEMP/temp/{{ inputs.file_name }} ./data/
cp $RUNNER_TEMP/temp/{{ inputs.file_name }} ./${HUGO_ROOT}data/

- name: Write version
if: steps.write-version.outputs.new_version == 'true'
run: |-
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add ./data/{{ inputs.file_name }}
git add ./${HUGO_ROOT}data/{{ inputs.file_name }}
git commit -m "(Automated) Bump version"
git push -f origin HEAD:refs/heads/automatic-version-update/versions

Expand Down
5 changes: 3 additions & 2 deletions .husky/check-cdocs-gitignore.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import sys
from pathlib import Path

GITIGNORE_PATH = Path("content/.gitignore")
_hugo_prefix = "hugo/" if Path("hugo/content").exists() else ""
GITIGNORE_PATH = Path(f"{_hugo_prefix}content/.gitignore")


def get_gitignore_patterns():
Expand All @@ -26,7 +27,7 @@ def get_gitignore_patterns():
if stripped.endswith(".md"):
# Paths in the gitignore are relative to content/, e.g. /en/foo/bar.md
# Convert to repo-relative patterns: content/en/foo/bar.md
repo_pattern = "content" + stripped
repo_pattern = f"{_hugo_prefix}content" + stripped
patterns.append(repo_pattern)
return patterns

Expand Down
12 changes: 7 additions & 5 deletions .husky/check-circular-aliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import re
from pathlib import Path

_hugo_prefix = "hugo/" if Path("hugo/content").exists() else ""

def parse_frontmatter(content):
"""Parse YAML frontmatter from markdown content."""
# Match frontmatter between --- delimiters
Expand Down Expand Up @@ -62,12 +64,12 @@ def get_staged_files():
text=True,
check=True
)
staged_files = [f for f in result.stdout.strip().split('\n')
if f.endswith('.md') and f.startswith('content/en/')]
staged_files = [f for f in result.stdout.strip().split('\n')
if f.endswith('.md') and f.startswith(f'{_hugo_prefix}content/en/')]
return staged_files if staged_files != [''] else []
except subprocess.CalledProcessError:
# Fallback to all markdown files for testing
content_dir = Path('content/en')
content_dir = Path(f'{_hugo_prefix}content/en')
if content_dir.exists():
return [str(f) for f in content_dir.rglob('*.md')]
return []
Expand Down Expand Up @@ -100,10 +102,10 @@ def check_circular_aliases():
# Calculate expected location path
if file_path.endswith('/_index.md'):
# For _index.md files: content/en/foo/bar/_index.md -> foo/bar
expected_location = file_path.replace('content/en/', '').replace('/_index.md', '')
expected_location = file_path.replace(f'{_hugo_prefix}content/en/', '').replace('/_index.md', '')
else:
# For regular .md files: content/en/foo/bar.md -> foo/bar
expected_location = file_path.replace('content/en/', '').replace('.md', '')
expected_location = file_path.replace(f'{_hugo_prefix}content/en/', '').replace('.md', '')

# Check each alias for circular reference
for alias in aliases:
Expand Down
16 changes: 9 additions & 7 deletions .husky/check-section-index.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import subprocess
from pathlib import Path

_hugo_prefix = "hugo/" if Path("hugo/content").exists() else ""


def get_repo_root():
"""Get the git repository root directory."""
Expand All @@ -26,7 +28,7 @@ def get_staged_files():
check=True
)
staged_files = [f for f in result.stdout.strip().split('\n')
if f.endswith('.md') and f.startswith('content/en/')]
if f.endswith('.md') and f.startswith(f'{_hugo_prefix}content/en/')]
return staged_files if staged_files != [''] else []
except subprocess.CalledProcessError:
return []
Expand Down Expand Up @@ -56,7 +58,7 @@ def dir_exists_on_base_branch(dir_name):
merge_base = result.stdout.strip()
# Check if the directory existed at the merge base
result = subprocess.run(
['git', 'ls-tree', '--name-only', merge_base, f'content/en/{dir_name}/'],
['git', 'ls-tree', '--name-only', merge_base, f'{_hugo_prefix}content/en/{dir_name}/'],
capture_output=True,
text=True,
check=True
Expand All @@ -66,7 +68,7 @@ def dir_exists_on_base_branch(dir_name):
# If there's no merge base (e.g. first commit), check if dir exists in HEAD
try:
result = subprocess.run(
['git', 'ls-tree', '--name-only', 'HEAD', f'content/en/{dir_name}/'],
['git', 'ls-tree', '--name-only', 'HEAD', f'{_hugo_prefix}content/en/{dir_name}/'],
capture_output=True,
text=True,
check=True
Expand All @@ -78,12 +80,12 @@ def dir_exists_on_base_branch(dir_name):

def has_index_file(repo_root, dir_name):
"""Check if a top-level directory has an _index.md or _index.mdoc.md."""
dir_path = repo_root / 'content' / 'en' / dir_name
dir_path = repo_root / f'{_hugo_prefix}content' / 'en' / dir_name
if (dir_path / '_index.md').exists() or (dir_path / '_index.mdoc.md').exists():
return True
# Also check if either variant is staged (new but not yet on disk)
for name in ('_index.md', '_index.mdoc.md'):
relative = f'content/en/{dir_name}/{name}'
relative = f'{_hugo_prefix}content/en/{dir_name}/{name}'
try:
subprocess.run(
['git', 'show', f':{relative}'],
Expand Down Expand Up @@ -131,9 +133,9 @@ def main():
print('=====================================', file=sys.stderr)

for dir_name in missing:
print(f'\n Directory: content/en/{dir_name}/', file=sys.stderr)
print(f'\n Directory: {_hugo_prefix}content/en/{dir_name}/', file=sys.stderr)
print(f' URL path: /{dir_name}/', file=sys.stderr)
print(f' Fix: Create content/en/{dir_name}/_index.md', file=sys.stderr)
print(f' Fix: Create {_hugo_prefix}content/en/{dir_name}/_index.md', file=sys.stderr)

print('\n=====================================', file=sys.stderr)
print(f'Found {len(missing)} directory(ies) missing _index.md.', file=sys.stderr)
Expand Down
17 changes: 17 additions & 0 deletions astro_reorg/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Docs repository reorg context

This repo is currently a Hugo site. We instead want it to contain a `hugo` and `astro` site side by side, with no overlap in their envs, `package.json` files, etc.

`astro_reorg/config.yaml` describes the relocation target for every file and folder at the top level of the repo.

`astro_reorg/execute_reorg.py` implements the file and folder path changes, and updates any dependencies on those paths, such as GitHub actions, CODEOWNERS, and Husky workflows.

`astro_reorg/helpers.py` contains shared utilities used by the other scripts (path manipulation, git/shell helpers, YAML config loading).

`astro_reorg/local_rollback.py` functions as an "undo" action for the reorg: removes `hugo/` and restores `.gitignore`, `.github/`, and `.husky/` from git.

`astro_reorg/validate_reorg.py` verifies the functionality of affected entities where possible.

`astro_reorg/resolve_pr_conflicts.py` finds open PRs with merge conflicts caused by the reorg, and either auto-fixes them (by replaying commits at post-reorg paths) or labels them for manual review. Defaults to dry-run mode; use `--no-dry-run` to apply changes.

You can ignore the `astro` folder, it's a remnant from another branch where an Astro site is being developed. It is completely out of scope.
Loading
Loading