The discourse-topic-github-release-action is a JavaScript action that can post published GitHub releases from a repository to a Discourse instance.
We use this on our main projects to automatically post releases to Roots Discourse.
name: Post release topic on Discourse
on:
release:
types: [published]
jobs:
post:
runs-on: ubuntu-latest
steps:
- uses: roots/discourse-topic-github-release-action@main
with:
discourse-api-key: ${{ secrets.DISCOURSE_RELEASES_API_KEY }}
discourse-base-url: ${{ secrets.DISCOURSE_BASE_URL }}
github-token: ${{ github.token }}
discourse-category: 11
discourse-tags:
releasesThe action automatically maps GitHub usernames to Discourse usernames by reading a discourse.yml file from your organization's .github repository.
- Create a
.githubrepository in your organization if it doesn't exist - Add a
discourse.ymlfile with the following format:
usernames:
github-username: discourse-username
another-user: their-discourse-nameWhen a release is published, the action will:
- Detect the GitHub username of the person who published the release
- Look up their username in the mapping
- Use the mapped Discourse username when creating the topic
For backward compatibility, if discourse-author-username is provided, that value is used directly. Otherwise, the action attempts username mapping (when a GitHub token is available) and falls back to system.
Required Discourse API key. Use a GitHub secret for this value.
Required Discourse base URL. Use a GitHub secret for this value.
Username for creating the topic on Discourse.
Default: system (if omitted, username mapping is attempted when a GitHub token is available)
Optional GitHub token for fetching the .github/discourse.yml file. The action uses this input first, then GITHUB_TOKEN if available.
The token must be able to read owner/.github/discourse.yml (repository contents read access). If that file cannot be read, the action falls back to system.
Category ID used for creating the topic on Discourse.
Tags applied to the topic when creating the topic on Discourse.