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
42 changes: 40 additions & 2 deletions .github/workflows/upload_sources_to_crowdin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,48 @@ name: Upload sources to Crowdin

on:
workflow_dispatch:
inputs:
paths_to_upload:
description: Optional docs-relative paths, comma or newline separated.
required: false
type: string

jobs:
upload-sources-to-crowdin:
runs-on: ubuntu-latest

steps:
- name: Placeholder
run: echo "No sync steps implemented yet."
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd

- name: Setup Node.JS
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
with:
node-version: 24
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Generate docs structure manifest
run: npm run generate_doc_structure

- name: Generate crowdin file
id: extract_files
env:
PATHS_TO_UPLOAD: ${{ github.event.inputs.paths_to_upload || '' }}
run: npm run generate_file

- name: crowdin action
uses: crowdin/github-action@8868a33591d21088edfc398968173a3b98d51706
with:
upload_sources: true
upload_translations: false
auto_approve_imported: true
download_translations: false
create_pull_request: false
base_url: 'https://pagopa.crowdin.com'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
265 changes: 265 additions & 0 deletions package-lock.json

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

26 changes: 26 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "devportal-docs",
"version": "1.0.0",
"description": "Devportal Docs",
"directories": {
"doc": "docs"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"generate_doc_structure": "ts-node-script --project tsconfig.json src/generateDocStructure.ts",
"generate_file": "ts-node-script --project tsconfig.json src/generateCrowdinConfig.ts"
},
"repository": {
"type": "git",
"url": "git+https://github.com/pagopa/devportal-docs.git"
},
"dependencies": {
"js-yaml": "^4.1.1"
},
"devDependencies": {
"@types/js-yaml": "^4.0.9",
"@types/node": "^25.2.3",
"ts-node": "^10.9.2",
"typescript": "^5.9.3"
}
}
36 changes: 36 additions & 0 deletions src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# ita_documentation

## Translation manifest

Before uploading sources to Crowdin, the workflow now generates a `docs-structure.json` manifest.

The manifest is meant to be translated together with the markdown sources and later consumed by the downstream repository to rename translated directories and files.

### Schema

The schema keeps the source folder and file names in object keys so they remain stable across locales. Only the `label` values are meant to be translated.

Directory nodes expose:

- `label`: the source name to translate.
- `directory`: `true`.
- `children`: nested directory and file entries.

File nodes expose:

- `label`: the source basename to translate.
- `directory`: `false`.

### Scripts

- `npm run generate_doc_structure`: generates `docs-structure.json`.
- `npm run generate_file`: regenerates `crowdin.yml`, including the manifest upload entry.

### Workflow dispatch input

When manually running `.github/workflows/upload_sources_to_crowdin.yml`, you can optionally set `paths_to_upload` to limit the uploaded markdown files.

- Paths are resolved from `docs/` by default, so `app-io/manuale-gruppi-io/1.0` expands to every `.md` file under `docs/app-io/manuale-gruppi-io/1.0`.
- Explicit markdown files are still supported, with or without the `docs/` prefix.
- Provide one path per line or a comma-separated list.
- `.gitbook` directories are ignored.
Loading