Skip to content

Instantly share code, notes, and snippets.

@simonewebdesign
Created September 19, 2022 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonewebdesign/6c8116b5ba21c629bbbf4cc1817d7769 to your computer and use it in GitHub Desktop.
Save simonewebdesign/6c8116b5ba21c629bbbf4cc1817d7769 to your computer and use it in GitHub Desktop.
Ruby script that updates all issues on a repo. You can use it to close all issues at once, for example. Uses the GitHub API via Octokit.rb.
require 'octokit'
client = Octokit::Client.new access_token: ENV['MY_GITHUB_PERSONAL_TOKEN']
client.auto_paginate = true
repo = 'ORG_NAME/REPO_NAME'
issues = client.issues repo
puts "Repo #{repo} has #{issues.length} issues."
issues.each do |issue|
num = issue.number
puts "Updating issue ##{num}..."
client.update_issue(repo, num, state: 'closed')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment