Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,36 @@ jobs:
with:
discourse-api-key: ${{ secrets.DISCOURSE_RELEASES_API_KEY }}
discourse-base-url: ${{ secrets.DISCOURSE_BASE_URL }}
discourse-author-username: ben
discourse-category: 11
discourse-tags:
releases
```

## Username Mapping

The action automatically maps GitHub usernames to Discourse usernames by reading a `discourse.yml` file from your organization's `.github` repository.

### Setting up username mapping

1. Create a `.github` repository in your organization if it doesn't exist
2. Add a `discourse.yml` file with the following format:

```yaml
usernames:
Log1x: Log1x
QWp6t: QWp6t
retlehs: ben
swalkinshaw: swalkinshaw
```

The mapping uses the format `github-username: discourse-username`. When a release is published, the action will:

1. Detect the GitHub username of the person who published the release
2. Look up their username in the mapping
3. Use the mapped Discourse username when creating the topic

If no mapping is found, the action will fall back to the `discourse-author-username` input (if provided) or use `system` as the default.

## Setup

### `discourse-api-key`
Expand All @@ -39,9 +63,13 @@ jobs:

### `discourse-author-username`

Username used for creating the topic on Discourse.
**Optional** Override username for creating the topic on Discourse. If not provided, the action will attempt to map the GitHub release author's username using the `.github/discourse.yml` mapping file.

**Default**: Uses username mapping, or `system` if no mapping is found

### `github-token`

**Default**: `system`
**Optional** GitHub token for fetching the `.github/discourse.yml` file. The action automatically uses the `GITHUB_TOKEN` environment variable, so you typically don't need to provide this.

### `discourse-category`

Expand Down
8 changes: 5 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ inputs:
description: 'Discourse API key'
required: true
discourse-author-username:
description: 'Author username. Default: system'
description: 'Author username override. If not provided, will use username mapping from .github/discourse.yml. Default: system'
required: false
github-token:
description: 'GitHub token for fetching .github/discourse.yml. Default: GITHUB_TOKEN'
required: false
default: 'system'
discourse-category:
description: 'ID of the post category'
required: false
Expand All @@ -28,5 +30,5 @@ outputs:
topic-url:
description: 'URL of the topic created'
runs:
using: 'node16'
using: 'node20'
main: 'dist/index.js'
Loading