You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
echo "✅ Using GitHub App token - comments will appear as faneX-ID Bot"
114
+
export GITHUB_TOKEN="$FANEX_BOT_TOKEN"
115
+
else
116
+
echo "ℹ️ Using GITHUB_TOKEN - comments will appear as github-actions[bot]"
117
+
echo " To use faneX-ID Bot identity, set secrets: FANEX_BOT_APP_ID and FANEX_BOT_PRIVATE_KEY"
118
+
fi
119
+
120
+
python demo_repos/fanex-id-bot/bot.py
69
121
```
70
122
123
+
### Token Configuration in Workflow
124
+
125
+
The workflow supports two authentication methods:
126
+
127
+
#### Method 1: GitHub App Token (Recommended)
128
+
129
+
**Required Secrets:**
130
+
- `FANEX_BOT_APP_ID`: Your GitHub App ID
131
+
- `FANEX_BOT_PRIVATE_KEY`: Your GitHub App private key (full PEM content)
132
+
133
+
**Benefits:**
134
+
- Comments appear as "faneX-ID Bot" instead of "github-actions[bot]"
135
+
- Better user experience and clearer bot identity
136
+
- More professional appearance
137
+
138
+
**Setup:** See [Token Configuration](#token-configuration) section above.
139
+
140
+
#### Method 2: GitHub Actions Token (Default)
141
+
142
+
**No configuration needed** - uses the automatically provided `GITHUB_TOKEN`.
143
+
144
+
**Limitations:**
145
+
- Comments appear as "github-actions[bot]"
146
+
- Less personalized bot identity
147
+
148
+
**Token Priority:**
149
+
1. If `FANEX_BOT_APP_ID` and `FANEX_BOT_PRIVATE_KEY` secrets are set, the workflow will generate a GitHub App token
150
+
2. Otherwise, it falls back to the default `GITHUB_TOKEN`
151
+
71
152
### Installation
72
153
73
154
1. Copy the `fanex-id-bot` directory to your repository
74
155
2. Add the workflow file to `.github/workflows/`
75
156
3. The bot will automatically respond to PR comments
76
157
158
+
## Token Configuration
159
+
160
+
The bot supports two authentication methods:
161
+
162
+
### Option 1: GitHub App Token (Recommended)
163
+
164
+
Using a GitHub App token allows the bot to post comments as "faneX-ID Bot" instead of "github-actions[bot]". This provides a better user experience and clearer bot identity.
165
+
166
+
#### Step 1: Create a GitHub App
167
+
168
+
1. Go to your organization or user settings
169
+
2. Navigate to **Developer settings** → **GitHub Apps**
170
+
3. Click **New GitHub App**
171
+
4. Configure the app:
172
+
- **Name**: `faneX-ID Bot` (or your preferred name)
173
+
- **Homepage URL**: Your repository URL
174
+
- **Webhook**: Optional (not needed for this bot)
175
+
- **Permissions**:
176
+
- **Repository permissions**:
177
+
- Contents: `Read`
178
+
- Pull requests: `Write`
179
+
- Actions: `Write`
180
+
- Issues: `Write`(for comments)
181
+
- **Where can this GitHub App be installed?**: Choose your organization or account
182
+
5. Click **Create GitHub App**
183
+
184
+
#### Step 2: Generate Private Key
185
+
186
+
1. After creating the app, scroll down to **Private keys**
187
+
2. Click **Generate a private key**
188
+
3. Save the downloaded `.pem` file securely (you'll need this for the secret)
189
+
190
+
#### Step 3: Install the App
191
+
192
+
1. Click **Install App** in the app settings
193
+
2. Select the organization or account where you want to install it
194
+
3. Select the repositories (or all repositories)
195
+
4. Click **Install**
196
+
197
+
#### Step 4: Get App ID
198
+
199
+
1. In the app settings, note the **App ID** (you'll need this for the secret)
200
+
201
+
#### Step 5: Configure Repository Secrets
202
+
203
+
Add the following secrets to your repository (Settings → Secrets and variables → Actions):
204
+
205
+
- **`FANEX_BOT_APP_ID`**: The App ID from step 4 (e.g., `123456`)
206
+
- **`FANEX_BOT_PRIVATE_KEY`**: The entire contents of the `.pem` file from step 2
207
+
208
+
**Example of private key format:**
209
+
```
210
+
-----BEGIN RSA PRIVATE KEY-----
211
+
MIIEpAIBAAKCAQEA...
212
+
(multiple lines)
213
+
...
214
+
-----END RSA PRIVATE KEY-----
215
+
```
216
+
217
+
#### Step 6: Update Workflow
218
+
219
+
The workflow will automatically detect these secrets and generate a token. No additional changes needed if using the provided workflow template.
220
+
221
+
### Option 2: GitHub Actions Token (Default)
222
+
223
+
If you don't configure a GitHub App, the bot will use the default `GITHUB_TOKEN` provided by GitHub Actions. This works out of the box but comments will appear as "github-actions[bot]".
224
+
225
+
**No configuration needed** - the `GITHUB_TOKEN` is automatically available in GitHub Actions workflows.
226
+
227
+
### Token Priority
228
+
229
+
The bot uses tokens in this order:
230
+
1. `FANEX_BOT_TOKEN` (if GitHub App is configured)
231
+
2. `GITHUB_TOKEN` (fallback, always available)
232
+
77
233
## Configuration
78
234
79
235
The bot can be configured via environment variables:
@@ -133,12 +289,79 @@ The bot consists of:
133
289
- **`comment_handler.py`**: Processes PR comments and responds
134
290
- **`action.yml`**: GitHub Action definition
135
291
292
+
## Token Setup Checklist
293
+
294
+
Use this checklist to set up the bot with a GitHub App token:
295
+
296
+
- [ ] Create GitHub App in organization/user settings
0 commit comments