This Cloudflare Worker fetches bug data from the Bugzilla API for a specified user, processes the data, and generates a dynamic SVG to visualize the contribution summary.
Awesome for showing off your Mozilla contributions
- Fetches bug data assigned to a specific user from the Bugzilla API.
- Normalizes the bug data for consistent handling of missing fields.
- Generates a dynamic SVG with a summary of bugs by their status (e.g., Assigned, Resolved, New).
- Returns the SVG as a response for easy embedding or use in other applications.
- Node.js
- Wrangler CLI installed globally:
npm install -g wrangler
- A Cloudflare account and a registered Worker project.
-
Clone the repository:
git clone https://github.com/<your-repo>/firefox-contribution-summary-worker.git cd firefox-contribution-summary-worker
-
Install dependencies (if any are added later).
-
Configure the
wrangler.toml
file with your Cloudflare account details:name = "firefox-contribution-summary-worker" type = "javascript" account_id = "your_account_id" workers_dev = true compatibility_date = "2024-11-27"
-
Modify the Bugzilla API
email1
query parameter infetchUserInfo
with your Bugzilla user email:const url = `https://bugzilla.mozilla.org/rest/bug?query_format=advanced&emailtype1=exact&emailassigned_to1=1&[email protected]`;
Start the development server locally:
wrangler dev src/index.ts
- Open your browser at http://localhost:8787 to test the Worker.
Deploy the Worker to Cloudflare:
wrangler deploy src/index.ts --name firefox-contribution-summary-worker
Once deployed, the Worker will be available at your Cloudflare Worker URL:
https://firefox-contribution-summary-worker.<your-subdomain>.workers.dev
The response will be a dynamically generated SVG summarizing bug contributions.
src/
├── index.ts # Main Worker script
├── types.ts # (Optional) TypeScript types
fetchUserInfo
: Fetches bug data for the specified user from Bugzilla.cleanBugsData
: Normalizes the bug data for consistent processing.handleRequest
: Handles HTTP requests and generates the SVG summary.
The Worker generates an SVG with:
- Bug counts by status (Assigned, Resolved, New).
- A Firefox logo for branding.
- Modify the SVG styles, colors, or layout in the
handleRequest
function. - Update the Bugzilla API query to fit your filtering criteria.
Contributions are welcome! Please fork the repository and submit a pull request.