Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #851 +/- ##
=======================================
Coverage 61.36% 61.36%
=======================================
Files 54 54
Lines 2112 2112
Branches 498 500 +2
=======================================
Hits 1296 1296
Misses 644 644
Partials 172 172 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a small scripting pipeline to parse CHANGELOG.md and sync release notes to Firefox Add-ons (AMO), including a simple token-bucket throttler and JWT-based authentication for the AMO API.
Changes:
- Introduce a
Throttlerutility for rate-limiting script requests. - Add Firefox AMO helpers to list versions and patch release notes.
- Add a
changelogpipeline script to parseCHANGELOG.mdand update AMO notes; update changelog formatting and add JWT dependencies.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| script/util/throttler.ts | New token-bucket throttler used to rate-limit AMO API calls. |
| script/pipeline/firefox.ts | New AMO API integration (JWT auth, list versions, patch release notes). |
| script/pipeline/changelog.ts | New CLI script to parse CHANGELOG.md and drive AMO release-note updates. |
| package.json | Adds jsonwebtoken and its types for the new pipeline scripts. |
| CHANGELOG.md | Normalizes some changelog formatting/content for parsing and display. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+1
to
+17
| import { readFileSync } from 'fs' | ||
| import { join } from 'path' | ||
| import { createArrayGuard, createObjectGuard, createOptionalGuard, createStringUnionGuard, isBoolean } from 'typescript-guard' | ||
| import { fileURLToPath } from 'url' | ||
| import { parseArgs, ParseArgsOptionsConfig } from 'util' | ||
| import { version as current } from '../../package.json' | ||
| import { exitWith } from '../util/process' | ||
| import { listFirefoxVersions, updateFirefoxReleaseNote } from './firefox' | ||
|
|
||
| type ChangeLog = { | ||
| version: string | ||
| date: string | ||
| changes: string[] | ||
| } | ||
|
|
||
| function parseChangelog(): ChangeLog[] { | ||
| const filePath = join(fileURLToPath(import.meta.url), '..', '..', '..', 'CHANGELOG.md') |
Comment on lines
+2
to
+19
| private tokens: number | ||
| private listRefillTs: number | ||
|
|
||
| constructor(private readonly capacity: number, private readonly refillRate: number) { | ||
| if (capacity <= 0) throw new Error('Capacity must be positive') | ||
| if (refillRate <= 0) throw new Error('Refill rate must be positive') | ||
| this.tokens = capacity | ||
| this.listRefillTs = Date.now() / 1000 | ||
| } | ||
|
|
||
| #refill(): void { | ||
| const now = Date.now() / 1000 | ||
| const elapsed = now - this.listRefillTs | ||
| if (elapsed > 0) { | ||
| const added = elapsed * this.refillRate | ||
| this.tokens = Math.min(this.capacity, this.tokens + added) | ||
| this.listRefillTs = now | ||
| } |
Comment on lines
+76
to
+77
| // one request per 20 seconds | ||
| const UPDATE_THROTTLER = new Throttler(1, 1 / 21) |
| const jsonResp = await response.json() | ||
| if (!isVersion(jsonResp)) { | ||
| console.log(JSON.stringify(jsonResp, null, 2)) | ||
| throw new Error('Errored to update Firefox version.') |
Comment on lines
+25
to
+27
| const TOKEN = generateJwtToken() | ||
| const HEADERS = { Authorization: `jwt ${TOKEN}` } as const | ||
| const THROTTLER = new Throttler(1, 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.