chore: add gt workflow - #1790
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
931ebdb to
548cce9
Compare
| ':(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/**')" |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)
| # 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] |
There was a problem hiding this comment.
may be nicer to use on.push.path to filter (instead of the workflow output) and avoid excess action runs
Description
gtReferences
Testing
Test dry-run: https://github.com/auth0/docs-v2/actions/runs/33107362396/job/98640718083?pr=1790
Checklist
CONTRIBUTING.md.