A Taskfile.dev-based tool to synchronize GitHub Actions secrets and variables from one repository to another quickly.
- List secrets/variables from source repository.
- Synchronize variables (with values).
- Export variables (with values) from a GitHub repository to a template file.
- Synchronize secrets (with user-provided values via a secret file).
- Synchronize variables (with user-provided values via a template file).
- Repository.
.
├── Taskfile.yml # Main task definitions
├── .env.example # Secrets template example
ghCLI installed and authenticatedtaskCLI installed (Taskfile.dev)
On macOS you can run the command below to get both tools
brew install gh go-task| Task | Description |
|---|---|
check-gh |
Verify gh CLI installed/authenticated |
var:ls |
List variables from source repo |
var:export |
Export variables from source repo to template file (new feature) |
var:sync |
Synchronize variables from source to target |
secret:ls |
List secret names from source repo |
secret:sync |
Synchronize secret from source to target using entries from the given secret file |
secret:export |
Export secret name from a GitHub repository to a secret file template |
sync |
Main entry point - synchronize secrets & variables |
task check-ghtask sync source=<owner>/<repo> target=<other>/<repo>task sync source=<owner>/<repo> target=<other>/<repo> secret_file=<secret_file>task sync source=<owner>/<repo> target=<other>/<repo> secret_file=<secret_file> mode=manualtask var:sync source=<owner>/<repo> target=<other>/<repo>task var:sync source=<source_variable_file> source_type=file target=<other>/<repo>task var:export source=<owner>/<repo> output_file=.env.varstask secret:sync source=<owner>/<repo> target=<other>/<repo>task secret:export source=<owner>/<repo> output_file=<secret_file>task var:ls source=<owner>/<repo>task secret:ls source=<owner>/<repo>- Use
gh variable list --json name,valueto get all variables - Use
gh variable set <name> --body <value> --repo <target>to set each
We cannot retrieve variable values via gh CLI due to security reasons.
- Export variables to template file, user manually fills values then:
- Use
gh variable list --repo <repo> --json name,value --jq '.[].name'to get all variable names.
- Use
- Synchronize variables to the target repository using the template file:
- Read variable entries from the template file and use
gh variable set <key> --repo <target> --body <value>to set each.
- Read variable entries from the template file and use
Le Minh Tri (a.k.a @ansidev).
Copyright © 2026-present Le Minh Tri.