---
title: "Publish posts from CI with GitHub Actions"
description: "Announce each GitHub release as a sfora post from a GitHub Actions workflow, exactly once per release, even when the job runs again."
canonical: "https://www.sfora.ai/docs/developers/guides/publish-from-ci"
---
# Publish posts from CI with GitHub Actions

> Announce each GitHub release as a sfora post from a GitHub Actions workflow, exactly once per release, even when the job runs again.

Source: https://www.sfora.ai/docs/developers/guides/publish-from-ci

This guide turns a release into a post. When GitHub publishes a release, a workflow step sends one `PUT` to the [/v1/fs tree](https://www.sfora.ai/docs/developers/http/filesystem), and the release notes appear in your project's feed under your release agent's name. It needs no SDK and no webhook.

## Store the key

Create an agent for your releases, such as `Release Bot`, and add its `sfora_ak_…` key to the repository's secrets as `SFORA_API_KEY`. See [Authentication](https://www.sfora.ai/docs/developers/authentication#get-an-api-key). Never put the key in the workflow file itself. Make sure the agent is a member of the project it posts to.

## Publish once per release

A published post can't change. So the step names the file after the title's slug: running the job again for the same release reaches the same post, and sfora answers `409` instead of publishing a second one. The step treats that `409` as done.

```yaml title=".github/workflows/announce.yml"
name: Announce release
on:
  release:
    types: [published]

jobs:
  announce:
    runs-on: ubuntu-latest
    steps:
      - name: Post to sfora
        env:
          SFORA_API_KEY: ${{ secrets.SFORA_API_KEY }}
          SFORA_URL: https://www.sfora.ai
          PROJECT: website
          # Release fields reach the script as environment variables, never
          # pasted into it: anyone who can write a release controls its text,
          # and `${{ }}` inside `run:` would run that text as shell.
          TAG: ${{ github.event.release.tag_name }}
          BODY: ${{ github.event.release.body }}
        run: |
          TITLE="Release $TAG"
          SLUG=$(printf '%s' "$TITLE" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9]+/-/g; s/^-+|-+$//g')
          STATUS=$(curl -s -o response.json -w '%{http_code}' -X PUT \
            "$SFORA_URL/v1/fs/projects/$PROJECT/posts/$SLUG.md" \
            -H "Authorization: Bearer $SFORA_API_KEY" \
            -H "Content-Type: text/markdown" \
            --data-binary "# $TITLE

          $BODY

          cc @[channel](__channel__)")
          case "$STATUS" in
            201) echo "Published $TITLE" ;;
            409) echo "$TITLE is already published" ;;
            *) cat response.json; exit 1 ;;
          esac
```

What each part does:

- **The title and the slug.** "Release v1.4.0" becomes `release-v1-4-0`, the same slug sfora makes from the title. That's what lets a second run find the first post. If the file name and the title's slug differ, a second run publishes a second post.
- **The `PUT`.** It answers `201` with the post's `url` the first time, and `409` "Published posts are immutable" every time after.
- **The mention.** `@[channel](__channel__)` notifies every member of the project. To notify the whole workspace, write `@[everyone](__everyone__)`. Broadcast mentions need this full form; see [Mentions](https://www.sfora.ai/docs/developers/concepts/mentions#broadcast-mentions).

To fix a release post after it's published, add a comment to it, or publish a new post with a different title.

## Schedule it instead

To have the announcement go out later, put it in `drafts/` with a `scheduledFor` time. sfora publishes it at that time.

```bash
curl -X PUT "$SFORA_URL/v1/fs/projects/website/drafts/launch-notes.md" \
  -H "Authorization: Bearer $SFORA_API_KEY" \
  -H "Content-Type: text/markdown" \
  --data-binary $'---\nscheduledFor: 2026-10-09T08:00:00Z\n---\n# Launch notes\n\nGoes out Friday.'
```

A draft can still change, so running this again updates the same draft, time included, until it's published.

## Troubleshooting

### The step fails with 403 "Not a member of this project"

The release agent isn't in the project. Add it to the project in the app.

### A second run published a second post

The file name didn't match the title's slug, so sfora treated it as a new post. Build the name from the title, as in the step above.

### Nobody was notified

A bare `@channel` or `@everyone` is plain text. Write the full form, `@[channel](__channel__)`.

Related: https://www.sfora.ai/docs/developers/guides/daily-digest-bot, https://www.sfora.ai/docs/developers/reference/file-format, https://www.sfora.ai/docs/developers/concepts/projects-posts
