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
986 changes: 497 additions & 489 deletions README.md

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions examples/platform-integrations/discord-bot/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DISCORD_TOKEN=your_discord_bot_token
DISCORD_CLIENT_ID=your_discord_application_client_id
DISCORD_GUILD_ID=optional_test_guild_id
APORT_API_KEY=your_aport_api_key
APORT_API_URL=https://aport.io/api/verify
APORT_POLICY_PACK=code.repository.merge.v1
58 changes: 58 additions & 0 deletions examples/platform-integrations/discord-bot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# APort Discord Verification Bot

This example shows how to verify team actions from Discord slash commands before a workflow continues.

## Commands

- `/aport-verify action:<action> resource:<resource> reason:<reason>` calls APort and returns the allow/deny decision.
- `/aport-status` shows the configured policy pack.

## Setup

1. Create a Discord application and bot in the Discord Developer Portal.
2. Copy `.env.example` to `.env`.
3. Fill in `DISCORD_TOKEN`, `DISCORD_CLIENT_ID`, and `APORT_POLICY_PACK`.
4. Optional: set `DISCORD_GUILD_ID` for fast command registration in one test server.

```bash
npm install
npm run register
npm start
```

## Example

```text
/aport-verify action:merge_pr resource:aporthq/aport-integrations#116 reason:approved review
```

The bot sends this context to APort:

```json
{
"actor": {
"type": "discord_user",
"id": "1234567890"
},
"action": "merge_pr",
"resource": "aporthq/aport-integrations#116",
"reason": "approved review"
}
```

## Configuration

| Variable | Description |
| --- | --- |
| `DISCORD_TOKEN` | Discord bot token. |
| `DISCORD_CLIENT_ID` | Discord application client id. |
| `DISCORD_GUILD_ID` | Optional guild id for test-server command registration. |
| `APORT_API_KEY` | APort API key when your policy requires authentication. |
| `APORT_API_URL` | APort verification endpoint. Defaults to `https://aport.io/api/verify`. |
| `APORT_POLICY_PACK` | Policy pack used for team action checks. |

## Test

```bash
npm test
```
Loading