Home Docs Workflow guides

Attach CI artifacts to a run

Automation handoff
Workflow

Attach CI artifacts to a run

Post selected text artifacts from CI with a scoped API key, then expose paste URLs in job summaries or failure comments.

When to use it

Use this when

  • A CI system needs to preserve log excerpts, generated diffs, or diagnostic JSON.
  • The artifact should expire independently from the CI provider retention policy.
Steps

Do this

  1. Create a scoped key Use an account API key with paste:create and, if later cleanup is needed, paste:revoke.
  2. Publish only text Use log excerpts, JSON summaries, or base64-encoded archives. Keep large binary artifacts in the CI provider or object storage.
  3. Record response fields Store id, url, raw_url, and revocation_token in the CI job output or secret store as appropriate.
Examples

Copyable commands

Curl from CI
tail -n 400 build.log > paste-artifact.log
python3 - <<'PY' > payload.json
import json, pathlib
print(json.dumps({
  "visibility": "unlisted",
  "access": "public",
  "expires_in_seconds": 1209600,
  "syntax_hint": "log",
  "title": "CI failure log",
  "body": pathlib.Path("paste-artifact.log").read_text(errors="replace")
}))
PY
curl -sS https://pastebin.ca/api/v1/pastes \
  -H "Authorization: Bearer $PBCA_API_KEY" \
  -H 'content-type: application/json' \
  --data-binary @payload.json
Operational notes

Keep in mind

  • Public feed pastes are inappropriate for routine CI failures unless the project intentionally publishes them.
  • The service enforces configured paste size limits; trim noisy logs before upload.