playwright-scripts
https://github.com/chenrui333/playwright-scripts.git
Automate changing GitHub package visibility from private to public using Playwright and Bun.
# macOS, Linux, WSL
curl -fsSL https://bun.sh/install | bash
# Or using Homebrew
brew install oven-sh/bun/bun
bun install
bunx playwright install chromium
# Or install all browsers: bunx playwright install
bun run setup
This will open a browser where you can log into GitHub. The session cookies will be saved in ./browser-data/ for future use.
bun start
bun install # Install dependencies
bunx playwright install chromium # Install browser (one-time)
bun run setup # Set up authentication (one-time)
bun start # Run the automation
Edit the CONFIG object in make-packages-public.mjs:
const CONFIG = {
username: 'chenrui333', // Your GitHub username
packagesUrl: '...', // URL to your private packages
userDataDir: './browser-data', // Persistent auth storage
headless: false, // Set true for background execution
timeout: 30000, // Operation timeout (ms)
retryAttempts: 1, // Retry count for failures
retryDelay: 2000, // Delay between retries (ms)
// Package filtering (set to null or '' to process all packages)
packageFilter: 'tap/', // Only process packages matching this prefix
// Optional parallel processing (experimental)
parallelProcessing: false, // Enable to process multiple packages at once
maxParallel: 3, // Max concurrent operations when parallel mode enabled
};
โน๏ธ GitHub Package Visibility Automation Script
======================================================================
โน๏ธ Collecting package links from private packages page...
โน๏ธ Found 15 packages so far...
โ
Collected 15 total package(s)
โน๏ธ Starting visibility change for 15 package(s)...
๐ฆ Progress: 1/15
โน๏ธ Processing package: my-package
โน๏ธ Confirmation string required: "my-package"
โ
Successfully changed my-package to public (3.2s)
๐ฆ Progress: 2/15
โน๏ธ Processing package: another-pkg
โ ๏ธ Package another-pkg is already public, skipping
...
======================================================================
โน๏ธ SUMMARY
======================================================================
Total packages found: 15
Successfully changed: 12
Already public (skipped): 2
Failed: 1
======================================================================
โก Performance Metrics:
Total time: 48.5s
Avg per package: 3.4s
Fastest: 2.1s
Slowest: 5.8s
======================================================================
Cause: GitHub UI changed or selector needs updating.
Fix: Inspect the settings page and update the selector in changePackageVisibility().
Cause: Modal didn't load or selector mismatch.
Fix: Increase delay after clicking "Change visibility" button or update selector.
Cause: Browser context expired or cookies invalid.
Fix: Re-run bun run setup to refresh authentication.
Cause: Processing packages too quickly.
Fix: Increase delay between packages in main loop (currently 1000ms).
./browser-data/headless: false (recommended for monitoring)Feel free to open issues or submit pull requests if you encounter GitHub UI changes or want to add features.
MIT