Skip to content

chore: add gt workflow - #1790

Open
nlucero wants to merge 4 commits into
mainfrom
chore/gt-workflow
Open

chore: add gt workflow#1790
nlucero wants to merge 4 commits into
mainfrom
chore/gt-workflow

Conversation

@nlucero

@nlucero nlucero commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Description

  • Add a new workflow for automatic translations via gt

References

Testing

Test dry-run: https://github.com/auth0/docs-v2/actions/runs/33107362396/job/98640718083?pr=1790

Checklist

  • I've read and followed CONTRIBUTING.md.
  • I've tested the site build for this change locally.
  • I've made appropriate docs updates for any code or config changes.
  • I've coordinated with the Product Docs and/or Docs Management team about non-trivial changes.

@mintlify

mintlify Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
auth0 🟢 Ready View Preview Aug 27, 2026, 7:19 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@mintlify

mintlify Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
auth0-docs-dev 🟢 Ready View Preview Aug 27, 2026, 7:19 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@mintlify

mintlify Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
auth0-docs-staging 🟢 Ready View Preview Aug 27, 2026, 7:19 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

Comment thread .github/workflows/translate.yml Outdated
Comment thread .github/workflows/translate.yml
Comment thread .github/workflows/translate.yml Outdated
Comment on lines +54 to +60
':(glob)main/docs/**/*.mdx' \
':(glob)main/docs/oas/**/*.json' \
':(glob)main/snippets/**/*.jsx' \
':(glob,exclude)main/docs/fr-ca/**' \
':(glob,exclude)main/docs/ja-jp/**' \
':(glob,exclude)main/snippets/fr-ca/**' \
':(glob,exclude)main/snippets/ja-jp/**')"

@nlucero nlucero Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: These pathspecs are duplicated and need to match the include/exclude paths in the gt config file. Technically, these could be derived from that file but that adds more complexity to this workflow:

  CFG=main/gt.config.json
  specs=()
  # includes: "./docs/**/*.mdx" -> ":(glob)main/docs/**/*.mdx"
  while IFS= read -r p; do
    specs+=(":(glob)main/${p#./}")
  done < <(jq -r '.files[].include[]' "$CFG")

  # excludes contain a "[locales]" placeholder -> expand against .locales[]
  while IFS= read -r p; do
    for loc in $(jq -r '.locales[]' "$CFG"); do
      specs+=(":(glob,exclude)main/${p#./}")   # with [locales] substituted by $loc
      # e.g. "./docs/[locales]/**/*.mdx" -> ":(glob,exclude)main/docs/fr-ca/**/*.mdx"
    done
  done < <(jq -r '.files[].exclude[]' "$CFG")

  git diff --name-only "$BEFORE" "$AFTER" -- "${specs[@]}"

# Compute which source files changed vs. the previous commit and filter
# them against the translation patterns from main/gt.config.json. Uses a
# plain git diff with pathspecs to avoid a third-party action.
- name: Detect changed source files

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw, the lychee (link checker) action uses https://github.com/tj-actions/changed-files to avoid precisely this git fussiness (getting consistent commit SHAs out of github actions is notoriously edge case prone; ask me how i know)

Comment on lines +7 to +11
# TODO: Automatic translation on push to main to be enabled in the future.
# When enabled, the diff step below decides whether any translatable source
# files actually changed before doing any work.
# push:
# branches: [main]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be nicer to use on.push.path to filter (instead of the workflow output) and avoid excess action runs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants