Postonus
CLI

CI

Run the CLI in a pipeline with an API key — no login step, no browser.

Last updated on

Set POSTONUS_API_KEY to an API key from the dashboard's Developer API page. It takes precedence over a stored session, so postonus login is never needed in CI:

- run: npx @postonus/cli post "Released ${{ github.ref_name }}" --to linkedin --optimal
  env:
    POSTONUS_API_KEY: ${{ secrets.POSTONUS_API_KEY }}

Because a key is scoped to one workspace (see API authentication), the post always lands in the workspace the key was created for — there is nothing else to configure.

A tag-triggered release post

name: Announce release
on:
  push:
    tags:
      - 'v*'

jobs:
  post:
    runs-on: ubuntu-latest
    steps:
      - run: npx @postonus/cli post "Released ${{ github.ref_name }}" --to x,linkedin --optimal --json
        env:
          POSTONUS_API_KEY: ${{ secrets.POSTONUS_API_KEY }}

--json makes the step's output parseable if a later step needs the resulting post id. No npm install -g needed — npx fetches the CLI on demand.

Checking the result without posting

Add --dry-run while wiring up a new workflow. It resolves channels and prints what would happen, without scheduling anything — see Scripting.

If a step fails

Exit code 1 means the request itself failed (a quota, a payment requirement, an invalid channel); 2 means the command was invoked wrong. Either way, the message on stderr (or .error in --json mode) names what happened — see Errors for the codes behind it.

On this page