Keep models, datasets, Spaces, and MCP repositories synchronized with MEGA Hub.
Mirror a GitHub repository—or just one folder—into a MEGA Hub model, dataset, Space, or MCP repository. The action creates the destination when needed, uploads changed content, removes files that disappeared from the source, and adds a direct repository link to the workflow summary.
Register the GitHub repository as a MEGA trusted publisher, then use GitHub's short-lived OIDC identity in the workflow:
name: Sync to MEGA Hub
on:
push:
branches: [main]
permissions:
contents: read
id-token: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: ohtensorplay/hub-sync@v1
with:
mega_repo_id: your-name/your-model
mega_oidc_resource: your-mega-handle
repo_type: modelEvery push to main now updates your-name/your-model on
MEGA Hub. mega_token remains available for
environments that cannot use OIDC.
- uses: ohtensorplay/hub-sync@v1
with:
mega_repo_id: your-organization/product-dataset
mega_oidc_resource: your-mega-handle
repo_type: dataset
subdirectory: exports/latest- uses: ohtensorplay/hub-sync@v1
with:
mega_repo_id: your-name/production-model
mega_oidc_resource: your-mega-handle
repo_type: model
include: |
*.json
*.safetensors
tokenizer/**
exclude: |
**/*.tmp
**/.DS_StoreMirroring is enabled by default. Set sync: "false" when the action should
upload selected files without removing other content already on MEGA Hub.
- uses: ohtensorplay/hub-sync@v1
with:
mega_repo_id: your-name/shared-assets
mega_oidc_resource: your-mega-handle
repo_type: dataset
sync: "false"| Input | Required | Default | Description |
|---|---|---|---|
mega_repo_id |
Yes | — | Destination in namespace/name form. |
mega_token |
One auth method | — | MEGA token with repository write permission. |
mega_oidc_resource |
One auth method | — | MEGA account handle for keyless GitHub Actions OIDC. |
repo_type |
No | space |
model, dataset, space, or mcp. |
subdirectory |
No | . |
Folder inside the checked-out GitHub workspace. |
revision |
No | main |
Destination branch. |
private |
No | false |
Create a private destination when it does not exist. |
sync |
No | true |
Remove destination files absent from the selected source tree. |
include |
No | — | Newline-separated globs to include. |
exclude |
No | .git/**, .github/** |
Newline-separated globs to exclude. |
allow_empty |
No | false |
Permit an intentionally empty selection. |
max_workers |
No | automatic | Maximum concurrent uploads. |
commit_message |
No | generated | Commit message recorded on MEGA Hub. |
github_repo_id |
No | current repository | Source name used in the generated commit message. |
mega_version |
No | latest | Pin the megatensors package used by the action. |
| Output | Description |
|---|---|
repo_url |
URL of the synchronized MEGA repository. |
source_directory |
Canonical source directory used by the action. |
- id: mega
uses: ohtensorplay/hub-sync@v1
with:
mega_repo_id: your-name/your-model
mega_oidc_resource: your-mega-handle
repo_type: model
- run: echo "Published to ${{ steps.mega.outputs.repo_url }}"- Prefer
mega_oidc_resourcewith a registered GitHub Actions trusted publisher; it exchanges the job identity for a short-lived MEGA token. Usemega_tokenonly when OIDC is unavailable, and grant only repository write access required by the destination. - Source paths are restricted to the checked-out workspace; symlinks cannot escape the selected directory.
- Use
ohtensorplay/hub-sync@v1for compatible v1 updates, or pin a full release such asohtensorplay/hub-sync@v1.0.0for immutable workflows.
MIT © MEGA