Skip to content

scripts: add missing/archived plugins #381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kenhys
Copy link
Contributor

@kenhys kenhys commented Jun 13, 2025

Note that GitHub API doesn't provide accurate
archived time in response, so just regards
last pushed_at.

See
https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#get-a-repository

obsolete-plugins.yml is important database for https://github.com/okkez/fluent-plugin-obsolete-plugins.

@kenhys kenhys changed the title jscripts: add missing/archived plugins scripts: add missing/archived plugins Jun 13, 2025
@kenhys kenhys requested review from Watson1978 and daipom June 13, 2025 11:28
@kenhys kenhys marked this pull request as draft June 16, 2025 05:41
@kenhys kenhys removed request for Watson1978 and daipom June 16, 2025 05:41
@kenhys kenhys force-pushed the update-obsolete-plugins branch from 4fdc1dd to 0ad09f0 Compare June 16, 2025 08:31
@kenhys kenhys marked this pull request as ready for review June 16, 2025 08:32
@kenhys kenhys requested review from Watson1978 and daipom June 16, 2025 08:32
Note that GitHub API doesn't provide accurate
archived time in response, so need to scrape from
GitHub VCS webpage.

See
https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#get-a-repository

Signed-off-by: Kentaro Hayashi <[email protected]>
@kenhys kenhys force-pushed the update-obsolete-plugins branch from 0ad09f0 to 43995a5 Compare June 16, 2025 10:08
@Watson1978
Copy link
Contributor

Watson1978 commented Jun 17, 2025

I created a script to check if Set “Git repository has gone away.” plugin still exists.

require 'bundler/inline'
gemfile do
  source 'https://rubygems.org'
  gem 'colorize'
end

require 'json'
require 'open-uri'
require 'yaml'
require 'colorize'


def plugin_info(name)
  @json ||= JSON.parse(File.read(File.expand_path(File.join(__dir__, 'plugins.json'))))
  @json.find { |gem| gem['name'] == name }
end

data = YAML.load_file(File.expand_path(File.join(__dir__, 'obsolete-plugins.yml')))
data.each do |name, note|
  if note.include?("gone away")
    gem = plugin_info(name)
    if gem
      uri = gem['source_code_uri'] || gem['homepage_uri']
    end

    status_code = 404
    unless uri.nil? || uri.empty?
      begin
        OpenURI.open_uri(uri, read_timeout: 5) { |f|
          status_code = f.status[0].to_i
        }
      rescue
      end
    end

    if status_code >= 400
      puts "[gone away] #{name}: #{uri}"
    else
      puts "#{name}: #{uri}".colorize(:green)
      # remove from obsolete plugins list because it is still available
      data.delete(name)
      # TODO: save the updated data to the YAML file
    end
  end
end

Existing plugins are displayed in green.
image

Some plugins still seem to exist.

FYI)
Before executing the script, apply #382 and execute ruby plugin.rb on terminal, and then execute above script.

@kenhys
Copy link
Contributor Author

kenhys commented Jun 17, 2025

Thanks,
It should reduce the number of false positives.

@kenhys kenhys marked this pull request as draft June 17, 2025 06:34
@kenhys
Copy link
Contributor Author

kenhys commented Jun 17, 2025

Changed to draft again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants