Created
September 19, 2022 18:32
-
-
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.
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
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