A GitHub Action that keeps your git-managed Glean agents in sync with your Glean workspace.
- On pull requests — creates a draft preview in Glean and posts a comment with preview links
- On merge — syncs updated agent definitions into Glean (staged or published) and posts run links back to the PR
name: Glean Agent Sync
on:
pull_request:
paths:
- '.glean/agents/**'
push:
branches:
- main
paths:
- '.glean/agents/**'
workflow_dispatch:
inputs:
agent_folder:
description: 'Specific agent folder to sync (leave blank to sync all changed)'
required: false
is_draft:
description: 'Force draft preview mode even on push'
required: false
default: 'false'
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # required for git diff to detect changed folders
- uses: askscio/glean-agent-import-action@v1
with:
instance-url-fe: 'https://your-company.glean.com'
instance-url-be: 'https://your-company-be.glean.com'
api-token: ${{ secrets.GLEAN_API_TOKEN }}Note:
fetch-depth: 0is required. The action usesgit diffto detect which agent folders changed since the base commit.
| Input | Required | Default | Description |
|---|---|---|---|
instance-url-fe |
✅ | — | Frontend instance URL used for preview/run links in PR comments (e.g. https://acme.glean.com) |
instance-url-be |
✅ | — | Backend instance URL for API calls (e.g. https://acme-be.glean.com) |
api-token |
✅ | — | Glean client API token with AGENTS scope |
agent-directory |
❌ | .glean/agents |
Path within the repo where agent folders live |
default-sync-mode |
❌ | staged |
Default sync mode on push/merge: staged or published. Can be overridden per-agent via sync-mode in glean-sync.yaml |
| Output | Description |
|---|---|
synced-agents |
JSON array of per-agent results: [{agentId, agentName, agentMode, mode, message, status}] |
When triggered via workflow_dispatch, the action reads these inputs from github.event.inputs:
| Input | Description |
|---|---|
agent_folder |
Sync a specific agent folder by name, skipping diff detection |
is_draft |
Set to true to force draft preview mode even on a push event |
Each agent lives in its own subfolder under agent-directory. The action supports two agent types, detected automatically from the folder contents.
.glean/agents/
└── my-agent/
├── spec.yaml # Agent config: id, name, description, tools, skills, etc.
├── instructions.md # Agent instructions (referenced by spec.yaml)
└── glean-sync.yaml # Optional — override sync-mode or message
spec.yaml example:
id: agent-abc123
name: My Agent
description: Does something useful
tools:
- toolProviderId: glean-search.glean/agents/
└── my-workflow/
├── my-workflow.json # Workflow spec JSON (exactly one .json file per folder)
└── glean-sync.yaml # Required — must contain agent-id
agent-id: agent-abc123 # Required for workflow agents; optional override for autonomous agents
sync-mode: staged # Optional: "staged" (default) or "published"
message: "My release note" # Optional: version message shown in Glean (defaults to PR title or commit subject)| Mode | Trigger | Behaviour |
|---|---|---|
draft_preview |
Pull request (always) | Creates a non-visible draft in Glean. Preview link posted to the PR. |
staged |
Push/merge (default) | Saves a new staged version pending moderator approval in Glean. |
published |
Push/merge (opt-in) | Immediately publishes the agent to all users. |
To publish on merge, set default-sync-mode: published on the action input, or set sync-mode: published in a specific agent's glean-sync.yaml.
- Detect — diffs changed files against the base SHA to find which agent folders changed. On
workflow_dispatch, syncs all folders (or the specific folder provided viaagent_folderinput). - Convert — for autonomous agents (
spec.yaml), converts the folder into the Glean workflow spec JSON format usingagent_converter.py. - Sync — calls the Glean API (
POST /rest/api/v1/agents/{id}) for each changed agent. - Comment — posts a PR comment with draft preview links (on pull requests) or sync status + run links (on push/merge).
Create a Glean client API token with the AGENTS scope and store it as a GitHub Actions secret (e.g. GLEAN_API_TOKEN).