CI and tokens
Use personal access tokens to schedule posts from GitHub Actions and other CI.
For automation, use a personal access token instead of device login. Create one in the app under Settings → CLI.
Secrets to set
| Secret / env | Value |
|---|---|
DUN_TOKEN |
dun_pat_… access token |
DUN_WORKSPACE_ID |
Workspace id from the app or dun workspace list |
Optional: pin a package version in CI (npx dunsocial@0.4.0) so upgrades are intentional.
Example: schedule on release
export DUN_TOKEN=your_token
export DUN_WORKSPACE_ID=your_workspace_id
dun posts schedule \
--text "We just shipped a new release" \
--accounts ACCOUNT_ID \
--in 5m \
--jsonGitHub Actions sketch
# In a workflow step, after setup-node:
npx --yes dunsocial@0.4.0 posts schedule \
--text "Shipped ${{ github.event.release.tag_name }}" \
--accounts ${{ secrets.DUN_X_ACCOUNT_ID }} \
--in 5m \
--jsonSet DUN_TOKEN and DUN_WORKSPACE_ID as repository secrets. CI=1 also enables --yes for destructive commands and defaults JSON when stdout is not a TTY.
PAT tips
- Tokens are bound to one workspace.
- Prefer the smallest scopes you need.
- Revoke from Settings → CLI if a secret leaks.
- Never log the full token.
- PATs cannot manage other tokens, billing, or AI routes.
Headless login with a token
dun auth login --token "$DUN_TOKEN"
dun auth status --jsonFor pure CI, exporting DUN_TOKEN is enough — you do not need to write a local config file.