1

Is there a way to upload csv file from UI and rails will upload it to github repo either with or without github_api?

Dong Jin
  • 21
  • 4

1 Answers1

0

If your application can support installing/declaring octokit (as in here), you can use that library for your GitHub goals:

client = Octokit::Client.new(:access_token => "YOUR_GITHUB_TOKEN")

Or:

client = Octokit::Client.new(
    client_id: ENV['GITHUB_CLIENT_ID'],
    client_secret: ENV['GITHUB_CLIENT_SECRET'],
)
client.user(ENV['GITHUB_CLIENT_ID'], :headers => { "X-GitHub-OTP" => "2fa-token"})

Then, using create_contents:

client.create_contents("username/repositoryName", "branchName", "path/to/yourFile.csv", "file...content")
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250