Skip to content

About

GitHub Action + CLI that syncs a Domo Code Engine package definition from its JSDoc and saves or deploys a new version on push.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

Repository files navigation

domo-codeengine-sync

A GitHub Action (and CLI) that syncs a Domo Code Engine package definition from its JSDoc and deploys a new version. Add it to any repo that holds a Code Engine package's source, and on push it regenerates the function manifest from the source's JSDoc, creates a new package version, and (by default) releases it.

It is the headless equivalent of the Domo Toolkit extension's "Generate Definition from JSDoc" feature, sharing the exact same parser via the domo-codeengine-manifest package, so CI and the extension produce identical definitions.

What it does on each run

  1. Reads the package source file from your repo.
  2. Fetches the current package version from Domo as the diff baseline.
  3. Parses the source's JSDoc into a function manifest (same parser as the extension).
  4. If any JSDoc has a blocking error, fails the run.
  5. If nothing changed, exits cleanly (no new version).
  6. Otherwise creates a new version (regenerating the required module.exports block) and, unless release: false, releases it.

Usage

# .github/workflows/sync-code-engine.yaml
name: Sync Code Engine Package

# Pushes to main that touch the package source (or its config) sync the Code
# Engine definition in Domo from the JSDoc in main.js. instance, packageId, and
# release live in domo-codeengine.json so this workflow stays boilerplate.
on:
  push:
    branches: [main]
    paths:
      - 'main.js'
      - 'domo-codeengine.json'
  # Lets you re-run the sync from the Actions tab without pushing a commit.
  workflow_dispatch:

jobs:
  sync:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5

      - id: sync
        uses: brycewc/domo-codeengine-sync@v1
        env:
          DOMO_DEVELOPER_TOKEN: ${{ secrets.DOMO_DEVELOPER_TOKEN }}

      - name: Summarize
        if: always() && steps.sync.outputs.results != ''
        env:
          RESULTS: ${{ steps.sync.outputs.results }}
          VERSIONS: ${{ steps.sync.outputs.versions }}
        run: |
          {
            echo '### Domo Code Engine sync'
            echo ''
            if [ -n "$VERSIONS" ]; then
              echo "Synced: \`$VERSIONS\`"
            else
              echo 'Nothing to sync, the definition already matches the JSDoc.'
            fi
            echo ''
            echo '```json'
            echo "$RESULTS"
            echo '```'
          } >> "$GITHUB_STEP_SUMMARY"

The Summarize step is optional: it writes the sync result to the run's job summary. Drop it if you don't want one.

Configuration

Provide a committed domo-codeengine.json (supports multiple packages):

{
  "instance": "acme",
  "packages": [{ "packageId": "…", "sourcePath": "main.js", "release": true }]
}

Or use single-package inputs (instance, package-id, source-path, release) directly in the workflow. The config file wins when present; inputs are the fallback.

The developer token always comes from the DOMO_DEVELOPER_TOKEN secret/env, never the config file. Create one in Domo under Admin > Authentication > Access Tokens; it must permit Code Engine version create and release.

Inputs

Input Description Default
instance Domo subdomain (acme) or full base URL. Optional if in config.
developer-token Prefer the DOMO_DEVELOPER_TOKEN env from a secret over this.
config-path Path to the config file. Defaults to ./domo-codeengine.json.
package-id Package UUID (single-package mode).
source-path Path to the package source .js (single-package mode).
release Release (deploy) after creating. Set false to stage unreleased. true

Outputs

Output Description
versions Comma-separated packageId@version list of synced packages. Empty when nothing changed.
results JSON array of per-package results. Also set to the partial results when the run fails.

CLI

DOMO_DEVELOPER_TOKEN=… npx domo-codeengine-sync \
  --instance acme --package-id <uuid> --source-path src/pkg.js
# or, with a config file in the cwd:
DOMO_DEVELOPER_TOKEN=… npx domo-codeengine-sync --config domo-codeengine.json
# stage without releasing:
DOMO_DEVELOPER_TOKEN=… npx domo-codeengine-sync --instance acme --package-id <uuid> --source-path src/pkg.js --no-release

Development

yarn            # install (pulls domo-codeengine-manifest straight from its git tag)
yarn test       # node --test
yarn build      # bundle to dist/index.js with ncc (commit the result)

A JS GitHub Action runs the committed dist/index.js, so run yarn build and commit dist/ whenever src/ changes. CI enforces this.

Note: domo-codeengine-manifest is not on npm and does not need to be. It resolves straight from a tag in its own repo (brycewc/domo-codeengine-manifest#v0.1.0), and yarn.lock pins the exact commit that tag points at, so installs stay reproducible even if the tag moves. Bumping the parser means pointing at a newer tag, then running yarn build and committing dist/.

About

GitHub Action + CLI that syncs a Domo Code Engine package definition from its JSDoc and saves or deploys a new version on push.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages