Code Monkey home page Code Monkey logo

github-project-to-csv's Introduction

github-project-to-csv

Simple cli to export github v2 projects to csv

Screenshot

Usage

./github-project-to-csv.rb --project https://github.com/users/fiedl/projects/2 --output project.csv

If you do encounter errors here, please check the troubleshooting section to make sure you have the correct ruby version and gems installed, or run the script via docker.

Installation

  1. Install the github cli: brew install gh
  2. Clone this repo: git clone https://github.com/fiedl/github-project-to-csv.git

Using github personal access tokens

Instead of using the gh command-line client, this tool also supports github personal access tokens. However, github does only support classic personal access tokens for now; fine-grained tokens do not work, yet.

Create a classic token xxx at https://github.com/settings/tokens. Then:

./github-project-to-csv.rb --project https://github.com/users/fiedl/projects/2 --output project.csv --token xxx

Running with docker

If you don't have a local ruby environment, it might be easiest to run this script via docker.

Install docker including the compose plugin: https://docs.docker.com/compose/install/

Then run this from the repository directory:

docker compose run app bundle exec ruby github-project-to-csv.rb --project https://github.com/users/fiedl/projects/2 --output project.csv --token xxx

When not using an access token, this might ask you to manually open a web browser and copy an authentication code in order to authenticate with github.

Troubleshooting

This script requires ruby version 3.2 or higher

Your local ruby version is too old. Please update according to the ruby documentation or run the script via docker.

require: cannot load such file

Some gems are missing locally. Run:

gem install pry httparty

Or run the script via docker.

Further Resources

Author and License

(c) 2023, Sebastian Fiedlschuster

MIT License

github-project-to-csv's People

Contributors

fiedl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

github-project-to-csv's Issues

Syntax error linked to implicit argument passed to HTTPParty.post (line 48)

Context

I just cloned the repository and tried following the steps described in the README file to get my project's data in a CSV.
I did not have ruby on my computer, so I started with a fresh install with Homebrew, and added the needed gems (HTTPParty and pry). Note that I am not experienced in Ruby!

Observed behavior

When running the following command:
sudo ./github-project-to-csv/github-project-to-csv.rb --project=https://github.com/users/AgentAGadge/projects/2 --output project2.csv --token xxx

I get: ./github-project-to-csv/github-project-to-csv.rb:48: syntax error, unexpected ','

Workaround
I modified github-project-to-csv.rb:48 from:
@result = HTTParty.post(url, body:, headers:)
to
@result = HTTParty.post(url, body: body, headers: headers)

And I got the script running perfectly well!

Issue
Am I missing something? Thanks!

Would it be possible to export the descriptions also?

Hi, this tool is indeed very useful in exporting the basic fields of the tasks from the github projects. Thank you for developing it.
My question is: would it be possible to extend the functionality of the tool to export the descriptions of the tasks as well?
The exported descriptions could be in a string format, minus the images.

Missing date values in csvs

The ruby code misses date values when it exports project data to a CSV file. It seems like this code needs a line to dig date values around L322 in field_value_attributes.

E.g.:
field_value_data.dig("date") || \

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.