Commit 0d0d99a
feat(updater): Add SSH key support and comprehensive authentication validation (#134)
* fix(updater): Add token validation and git credential configuration
Addresses GitHub Actions checkout authentication issues by:
- Adding early token validation with clear error messages
- Configuring git credentials explicitly to prevent "terminal prompts disabled" errors
This helps prevent and diagnose common token issues like:
- Expired tokens
- Missing expiration dates
- Insufficient scopes
- Incorrect secret references
Related to actions/checkout#664
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: Escape template expression in error message
* fix(updater): Remove token syntax echo from validation error message
* fix: Improve token validation to detect malformed tokens
* refactor: Use PowerShell for token validation and git config
* feat: Add token scope validation
Checks token scopes using x-oauth-scopes header:
- Reports scopes for classic PATs
- Warns if repo/public_repo scope missing
- Provides guidance for fine-grained PATs
Based on https://github.com/orgs/community/discussions/25259
* fix: Reintroduce token validity and access checks in the validation process
* fix(updater): Remove token syntax echo from validation error message
* feat: Enhance whitespace detection in token validation
Shows detailed information when whitespace is detected:
- Token length
- Position of whitespace character
- Type of whitespace (newline, space, tab, etc)
This helps quickly identify malformed token secrets.
* fix: Remove debug output for token preview in error handling
* feat: Add explicit check for SSH keys in token validation
Detects when an SSH private key is mistakenly passed as api-token.
Provides clear error message explaining the difference between
SSH keys and GitHub tokens.
This catches the error before the generic whitespace check.
* feat: Add SSH key support as alternative to token authentication
Changes:
- Add ssh-key input parameter
- Make api-token optional when ssh-key is provided
- Pass ssh-key to actions/checkout steps
- Skip token validation when using SSH key
- Skip git credential config when using SSH key
- Validate that only one auth method is provided
This allows the action to work with deploy keys, matching the
functionality of the previous reusable workflow implementation.
Refs: https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#push-using-ssh-deploy-keys
* fix: Allow both api-token and ssh-key together
SSH key can be used for git operations while token is used
for GitHub API calls (gh commands, PR creation, etc).
This is a valid and useful configuration.
* refactor: Split authentication validation into separate steps
Changes:
- Step 1: Validate authentication inputs (checks at least one is present)
- Step 2: Validate API token (runs only if token provided)
- Step 3: Validate SSH key (runs only if SSH key provided)
Benefits:
- Clearer separation of concerns
- Easier to read and maintain
- Each validation only runs when relevant
- SSH key validation now checks format
* refactor: Remove manual git credential configuration
The actions/checkout action already handles git credential
configuration when token or ssh-key is provided.
Manual configuration was redundant and could potentially
interfere with checkout's credential handling.
* docs: Add changelog entry and update v3 breaking changes
- Add feature and fix entries for SSH key support and authentication validation
- Add note to v3 breaking changes about SSH key support in v3.1
- Reference issue #128 and PR #134
* docs: Remove commented-out api-token option from changelog
* fix: Fallback to github.token when api-token is empty
When using only ssh-key (no api-token), GH_TOKEN was set to empty string,
causing gh CLI to refuse authentication instead of falling back to the
default GITHUB_TOKEN. This broke critical steps that use gh api:
- Parse existing PR URL
- Get changelog
- Update dependency (when filtering by GH release titles)
Changed all instances of:
GH_TOKEN: ${{ inputs.api-token }}
To:
GH_TOKEN: ${{ inputs.api-token || github.token }}
This ensures gh CLI always has valid authentication.
Fixes seer-by-sentry review comment:
#134 (comment)
* fix: Update updater version to use latest stable release
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 6272a50 commit 0d0d99a
2 files changed
+149
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
11 | 17 | | |
12 | 18 | | |
13 | 19 | | |
14 | 20 | | |
| 21 | + | |
15 | 22 | | |
16 | 23 | | |
17 | 24 | | |
| |||
52 | 59 | | |
53 | 60 | | |
54 | 61 | | |
55 | | - | |
| 62 | + | |
56 | 63 | | |
57 | 64 | | |
58 | 65 | | |
| |||
63 | 70 | | |
64 | 71 | | |
65 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
66 | 88 | | |
67 | 89 | | |
68 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
| |||
117 | 122 | | |
118 | 123 | | |
119 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
120 | 235 | | |
121 | 236 | | |
122 | 237 | | |
| |||
137 | 252 | | |
138 | 253 | | |
139 | 254 | | |
140 | | - | |
| 255 | + | |
| 256 | + | |
141 | 257 | | |
142 | 258 | | |
143 | 259 | | |
| |||
150 | 266 | | |
151 | 267 | | |
152 | 268 | | |
153 | | - | |
| 269 | + | |
154 | 270 | | |
155 | 271 | | |
156 | 272 | | |
| |||
194 | 310 | | |
195 | 311 | | |
196 | 312 | | |
197 | | - | |
| 313 | + | |
198 | 314 | | |
199 | 315 | | |
200 | 316 | | |
| |||
221 | 337 | | |
222 | 338 | | |
223 | 339 | | |
224 | | - | |
| 340 | + | |
225 | 341 | | |
226 | 342 | | |
227 | 343 | | |
| |||
276 | 392 | | |
277 | 393 | | |
278 | 394 | | |
279 | | - | |
| 395 | + | |
| 396 | + | |
280 | 397 | | |
281 | 398 | | |
282 | 399 | | |
| |||
287 | 404 | | |
288 | 405 | | |
289 | 406 | | |
290 | | - | |
| 407 | + | |
291 | 408 | | |
292 | 409 | | |
293 | 410 | | |
| |||
297 | 414 | | |
298 | 415 | | |
299 | 416 | | |
300 | | - | |
| 417 | + | |
301 | 418 | | |
302 | 419 | | |
303 | 420 | | |
| |||
0 commit comments