Coder Social home page Coder Social logo

sshaw / export-pull-requests Goto Github PK

View Code? Open in Web Editor NEW
109.0 7.0 24.0 41 KB

Export pull requests and/or issues to a CSV file. Supports GitHub, GitLab, and Bitbucket

Ruby 100.00%
github pull-requests csv ruby gitlab bitbucket issues github-issues-export

export-pull-requests's Introduction

Export Pull Requests

Export pull requests/merge requests and/or issues to a CSV file.

Supports GitHub, GitLab, and Bitbucket.

Installation

Ruby is required. With Ruby installed run:

gem install export-pull-requests

This installs the epr executable.

Usage

usage: epr [options] user/repo1 [user/repo2...]
    -b, --body                       Include the issue/pr body description in the output (GitHub only)
    -c, --creator=USER1,USER2,...    Export PRs created by given username(s); prepend `!' to exclude user
    -e, --endpoint=URL               Endpoint URL for 'enterprise', etc... repositories
    -m, --milestone=WHAT             Export items assigned to the given milestone (GitHub/GitLab only)
    -a, --assignee=USER              Export items assigned to the given user (GitHub/GitLab only)
    -l, --labels=LABEL(S)            Export items with the given label(s) (GitHub/GitLab only)
    -h, --help                       Show this message
    -p, --provider=NAME              Service provider: bitbucket, github, or gitlab; defaults to github
    -s, --state=STATE                Export items in the given state, defaults to open
    -t, --token=TOKEN                API token
    -x, --export=WHAT                What to export: pr, issues, or all; defaults to all
    -v, --version                    epr version

Config

These can all be set by one of the below methods or via the command line.

Token

The API token can be set by:

  • EPR_TOKEN environment variable
  • epr.token setting in .gitconfig (add via git config --add epr.token <your API token>)
  • github.oauth-token setting in .gitconfig

Default Service

github is the default. You can set a new default via EPR_SERVICE.

Examples

Export open PRs and issues in sshaw/git-link and sshaw/itunes_store_transporter:

epr sshaw/git-link sshaw/itunes_store_transporter > pr.csv

Export open pull request not created by sshaw in padrino/padrino-framework:

epr -x pr -c '!sshaw' padrino/padrino-framework > pr.csv

Export open merge requests from a GitLab project:

epr -x pr -p gitlab gitlab-org/gitlab-ce > pr.csv

Export all issues from a GitLab project:

epr -x issues -p gitlab gitlab-org/gitlab-ce > pr.csv

Service Notes

To connect to a custom/"Enterprise" installation of any of the supported services use the endpoint option (-e).

The provided URL must point the API endpoint, not the user-facing site. For GitHub this is http(s)://YOUR-SITE/api/v3.

Bitbucket

Due to various issues with the Bitbucket gem support for Bitbucket requires using a Ruby version < 3 and manually installing the Bitbucket library via gem install bitbucket_rest_api.

Alternatively, on a Ruby version < 3 you can run: gem install export-pull-requests -v=0.3.7

You can use app passwords for the API token. Just provide your token info in bitbucket_username:app_password format:

epr -p bitbucket -t bitbucket_username:app_password user/repo1

GitLab

Authentication can be done via a personal access token.

Enterprise editions of GitLab have an issue export feature.

See Also

  • Batch Labels - Add/remove labels in batches to/from GitHub issues and pull requests.

Author

Skye Shaw [skye.shaw AT gmail]

License

Released under the MIT License: www.opensource.org/licenses/MIT


Made by ScreenStaring

export-pull-requests's People

Contributors

cboyden-ucb avatar mjjs avatar sshaw avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

export-pull-requests's Issues

Adding query parameters `merge-from` and `merge-to` for PRs?

Is it possible to add query parameters merge-from and merge-to for PRs, so that we can filter PRs that's from/to certain branches with keyword/pattern please?

It would be handy if we can search PRs from bugfix\/.*, or PRs to develop. Currently we have to manually add keywords in title, or use labels to achieve this.

How to use milestone option

I tried to use it but it doesn't seem to be working - it's exporting all the PRs.

Example. I have a Mainnet milestone where I want to list all the PRs belonging to it.

epr -x pr -s closed -m Mainnet CasperLabs/casper-node

As the output, I get a list of all closed PR's. I tried also -m "Mainnet" and -m="Mainnet"

Latest published gem does not contain most recent bug fixes

Hello,

First of all thank you for creating this tool, it is very useful!

I did notice that the published gem, installed via gem install export-pull-requests throws an error if you pass the -b flag to retrieve the body.

/Library/Ruby/Gems/2.3.0/gems/export-pull-requests-0.2.1/bin/epr:275:in <top (required)>': invalid option: -b (OptionParser::InvalidOption)`

Cloning the repository and running the binary directly works as expected.

Could you please publish the latest version of the gem?

Add a column for labels?

Is there a command or way to create a column with any labels associated with exported issues?

Option -e do not works.

I want all the Pull Requests for some organization.
I have tried the command, epr -e orgs/:org > all_data.csv
Unfortunately, I am receiving an error, usage: epr [options] user/repo1 [user/repo2...]

Results do not include PR creators

Here is the command I'm running:

epr -p bitbucket -t bitbucket_username:app_password user/repo1 -x pr -s all> pr.csv

image

The resulted table doesn't include any information regarding PR creators
image

When I use it with 'creator' option, like -c 'username' it returns an empty table.

bitbucket usage

Hey Skye,

Can you please clarify bitbucket usage?

Bitbucket
You can use app passwords for the API token. Just provide your token HTTP Auth style using: username:app_password.

how can you incorporate this "http auth style" into your cli ? I have an app password from bitbucket. Not sure if username needed and how to incorporate.

Thanks!

epr does not work on Windows 10

I installed "rubyinstaller-devkit-3.0.1-1-x64" and then installed epr.

C:\Windows\System32>epr --help
E:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/faraday-0.9.2/lib/faraday/options.rb:153:in new': tried to create Proc object without a block (ArgumentError) from E:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/faraday-0.9.2/lib/faraday/options.rb:153:in memoized'
from E:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/faraday-0.9.2/lib/faraday/options.rb:234:in <class:ProxyOptions>' from E:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/faraday-0.9.2/lib/faraday/options.rb:216:in module:Faraday'
from E:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/faraday-0.9.2/lib/faraday/options.rb:1:in <top (required)>' from <internal:E:/Ruby30-x64/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in require'
from internal:E:/Ruby30-x64/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb:85:in require' from E:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/faraday-0.9.2/lib/faraday.rb:80:in block in require_libs'
from E:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/faraday-0.9.2/lib/faraday.rb:79:in each' from E:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/faraday-0.9.2/lib/faraday.rb:79:in require_libs'
from E:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/faraday-0.9.2/lib/faraday.rb:240:in <module:Faraday>' from E:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/faraday-0.9.2/lib/faraday.rb:16:in <top (required)>'
from internal:E:/Ruby30-x64/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb:85:in require' from <internal:E:/Ruby30-x64/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in require'
from E:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/github_api-0.19.0/lib/github_api.rb:5:in <top (required)>' from <internal:E:/Ruby30-x64/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in require'
from internal:E:/Ruby30-x64/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb:85:in require' from E:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/export-pull-requests-0.3.5/bin/epr:8:in <top (required)>'
from E:/Ruby30-x64/bin/epr:23:in load' from E:/Ruby30-x64/bin/epr:23:in

'

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.