Skip to content
Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MEGA

Keep models, datasets, Spaces, and MCP repositories synchronized with MEGA Hub.

GitHub Release Live smoke test MIT License

MEGA Hub Sync

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.

Quick start

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: model

Every push to main now updates your-name/your-model on MEGA Hub. mega_token remains available for environments that cannot use OIDC.

Common recipes

Publish one directory

- 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

Select files with globs

- 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_Store

Keep destination-only files

Mirroring 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"

Inputs

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.

Outputs

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 }}"

Security and versioning

  • Prefer mega_oidc_resource with a registered GitHub Actions trusted publisher; it exchanges the job identity for a short-lived MEGA token. Use mega_token only 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@v1 for compatible v1 updates, or pin a full release such as ohtensorplay/hub-sync@v1.0.0 for immutable workflows.

License

MIT © MEGA

About

Mirror models, datasets, mcps, and spaces from GitHub to MEGA Hub

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors