-
Notifications
You must be signed in to change notification settings - Fork 1
feat(*): automated update workflow #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
d598908
f0a1651
7b8e935
a0ad658
5e98d2b
52cca93
5f2213f
3329186
3edfd81
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| name: update-from-dispatch | ||
|
|
||
| on: | ||
| repository_dispatch: | ||
| types: [api-update] | ||
|
|
||
| jobs: | ||
| update: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Resolve target branch | ||
| id: resolve_branch | ||
| run: | | ||
| TAG="${{ github.event.client_payload.release_tag }}" | ||
| # Fail fast if release_tag is missing or empty | ||
| if [[ -z "$TAG" ]]; then | ||
| echo "::error::release_tag is missing or empty in the repository_dispatch payload." | ||
| exit 1 | ||
| fi | ||
| # Validate that the tag matches the expected semver pattern (e.g. v1.2.3 or 1.2.3) | ||
| if [[ ! "$TAG" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then | ||
| echo "::error::release_tag '$TAG' does not match the expected semver pattern (e.g. v1.2.3 or 1.2.3)." | ||
| exit 1 | ||
| fi | ||
| # Strip leading 'v' if present, then extract major.minor | ||
| SEMVER="${TAG#v}" | ||
| MAJOR=$(echo "$SEMVER" | cut -d. -f1) | ||
| MINOR=$(echo "$SEMVER" | cut -d. -f2) | ||
| BRANCH="${MAJOR}.${MINOR}.x" | ||
| echo "branch=$BRANCH" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Checkout or create target branch | ||
| run: | | ||
| BRANCH="${{ steps.resolve_branch.outputs.branch }}" | ||
| git fetch origin | ||
| if git ls-remote --exit-code --heads origin "$BRANCH"; then | ||
| git checkout "$BRANCH" | ||
| else | ||
| git checkout -b "$BRANCH" origin/master | ||
ChronosSF marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| git push origin "$BRANCH" | ||
| fi | ||
|
|
||
| - name: Checkout igniteui-angular | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: IgniteUI/igniteui-angular | ||
| ref: ${{ github.event.client_payload.release_tag }} | ||
| path: igniteui-angular | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
|
|
||
| - name: Install dependencies | ||
| working-directory: igniteui-angular | ||
| run: npm ci | ||
|
|
||
| - name: Build igniteui-angular | ||
| working-directory: igniteui-angular | ||
| run: npm run build:lib | ||
|
|
||
ChronosSF marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Export TypeDoc JSON | ||
| working-directory: igniteui-angular | ||
| run: npm run build:typedoc:export | ||
|
|
||
| - name: Copy TypeDoc JSON to this repo | ||
| run: cp igniteui-angular/dist/igniteui-angular/docs/typescript-exported/igniteui-angular.json typedoc/en/igniteui-angular.json | ||
|
|
||
| - name: Export SASS API | ||
| working-directory: igniteui-angular | ||
| run: npm run build:sassdoc:export | ||
|
|
||
| - name: Copy SASS API to this repo | ||
| run: | | ||
| mkdir -p sassdoc/en | ||
| rm -rf sassdoc/en/* | ||
| cp -r igniteui-angular/i18nRepo/sassdoc/en/. sassdoc/en/ | ||
|
|
||
| - name: Extract i18n translatable strings | ||
| run: node scripts/i18n-extract.mjs --input=typedoc/en/igniteui-angular.json --output=typedoc/en/i18n-translatable.json | ||
|
|
||
| - name: Commit and push changes | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git add -A | ||
| if git diff --cached --quiet; then | ||
| echo "No changes to commit; skipping commit and push." | ||
| else | ||
| git commit -m "chore: update API for ${{ github.event.client_payload.release_tag }} ($(date -u +%Y-%m-%d))" | ||
| git push origin HEAD | ||
| fi | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,3 +59,6 @@ typings/ | |
|
|
||
| # next.js build output | ||
| .next | ||
|
|
||
| # Cloned repository used by CI workflow | ||
| igniteui-angular/ | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,153 @@ | ||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * i18n-extract.mjs | ||||||||||||||||||||||
| * | ||||||||||||||||||||||
| * Walks the typedoc EN JSON and produces a flat id → translation-unit map. | ||||||||||||||||||||||
| * All comment parts (text + inline code) are merged into a single string per | ||||||||||||||||||||||
| * field so that translation agents receive plain prose, not a fragmented array. | ||||||||||||||||||||||
| * | ||||||||||||||||||||||
| * Output format (single file): | ||||||||||||||||||||||
| * { | ||||||||||||||||||||||
| * "totalItems": 1234, | ||||||||||||||||||||||
| * "items": { | ||||||||||||||||||||||
| * "27444": { "summary": "Defines the possible positions…" }, | ||||||||||||||||||||||
| * "27500": { | ||||||||||||||||||||||
| * "summary": "Gets or sets the `value`.", | ||||||||||||||||||||||
| * "blockTags": [ | ||||||||||||||||||||||
| * { "tag": "@param", "name": "value", "text": "The value to set." }, | ||||||||||||||||||||||
| * { "tag": "@returns", "text": "The resolved value." } | ||||||||||||||||||||||
| * ] | ||||||||||||||||||||||
| * } | ||||||||||||||||||||||
| * } | ||||||||||||||||||||||
| * } | ||||||||||||||||||||||
| * | ||||||||||||||||||||||
| * Usage: | ||||||||||||||||||||||
| * node i18n-extract.mjs | ||||||||||||||||||||||
| * node i18n-extract.mjs --input=i18nRepo/typedoc/en/igniteui-angular.json | ||||||||||||||||||||||
| * node i18n-extract.mjs --output=i18n-translatable.json | ||||||||||||||||||||||
| * node i18n-extract.mjs --chunk-size=50 (items per chunk file, 0 = single file) | ||||||||||||||||||||||
|
Comment on lines
+23
to
+27
|
||||||||||||||||||||||
| * Usage: | |
| * node i18n-extract.mjs | |
| * node i18n-extract.mjs --input=i18nRepo/typedoc/en/igniteui-angular.json | |
| * node i18n-extract.mjs --output=i18n-translatable.json | |
| * node i18n-extract.mjs --chunk-size=50 (items per chunk file, 0 = single file) | |
| * Usage (from repo root): | |
| * node scripts/i18n-extract.mjs | |
| * node scripts/i18n-extract.mjs --input=typedoc/en/igniteui-angular.json | |
| * node scripts/i18n-extract.mjs --output=typedoc/en/i18n-translatable.json | |
| * node scripts/i18n-extract.mjs --chunk-size=50 (items per chunk file, 0 = single file) |
Copilot
AI
Mar 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default paths are resolved relative to scripts/ (resolve(__dirname, './typedoc/...')), but this repo’s typedoc/ folder lives at the repository root (sibling of scripts/). Running the script with no --input/--output will fail because scripts/typedoc/... doesn’t exist. Update the defaults to resolve to ../typedoc/... (or use process.cwd()-relative paths) so the documented node ... usage works out of the box.
| const EN_PATH = args.input ?? resolve(__dirname, './typedoc/en/igniteui-angular.json'); | |
| const OUT_PATH = args.output ?? resolve(__dirname, './typedoc/en/i18n-translatable.json'); | |
| const CHUNK_SIZE = parseInt(args['chunk-size'] ?? '0', 10); // 0 = no splitting | |
| const CHUNKS_DIR = args['chunks-dir'] ?? resolve(__dirname, 'i18n-chunks'); | |
| const EN_PATH = args.input ?? resolve(__dirname, '../typedoc/en/igniteui-angular.json'); | |
| const OUT_PATH = args.output ?? resolve(__dirname, '../typedoc/en/i18n-translatable.json'); | |
| const CHUNK_SIZE = parseInt(args['chunk-size'] ?? '0', 10); // 0 = no splitting | |
| const CHUNKS_DIR = args['chunks-dir'] ?? resolve(dirname(OUT_PATH), 'i18n-chunks'); |
Uh oh!
There was an error while loading. Please reload this page.