Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Change watch settings in Github to release-only in bulk
// By jonashaag https://github.com/isaacs/github/issues/410#issuecomment-442248565
const child_process = require('child_process')
const puppeteer = require('puppeteer')
const devices = require('puppeteer/DeviceDescriptors')
const iPhone = devices['iPhone 6']
const USER = 'youruser'
const PW = 'xxxxxx'
// Get starred repos
let page = 1
let urls = []
while (1) {
const cmd = `curl -s "https://api.github.com/users/${USER}/starred?per_page=100&page=${page}"`
res = JSON.parse(child_process.execSync(cmd))
if (!res.length) break
for (let r in res) {
urls.push(r.html_url)
}
page++
}
// Update to release-only
(async () => {
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.emulate(iPhone)
await page.goto('https://github.com/login')
await page.type('[name=login]', USER)
await page.type('[name=password]', PW)
await page.click('[type=submit]')
setTimeout(async () => {
for (let url of urls) {
console.log(url)
await page.goto(url)
if (await page.$('[value=included].selected')) {
await page.click('[value=release_only]')
}
}
await browser.close()
}, 1000)
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment