Skip to content
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

Add '!ListPRs' command for GitHub #13

Merged
merged 17 commits into from
Feb 15, 2017

Conversation

apolikamixitos
Copy link
Contributor

  • Add '!ListPRs' command to list pull requests in a repo.

  • Reorganized the Dockerfile for quick builds

  • Add 'send_raw' to send raw messages instead of attachments based ones (issues with displaying large tables with attachments)

@apolikamixitos apolikamixitos changed the title Add GitHub for '!ListPRs' command Add '!ListPRs' command for GitHub Feb 13, 2017
Mike Grima and others added 2 commits February 13, 2017 14:45
- Enabled Travis testing
- Added a "setup.py"
- Updated the Docker config
- Added tests for Slack sending
- Fixed a bug in the quoted argument parsing to support multiple quoted strings.
- Full tests for `bot_components/slack_comm.py`
@mikegrima
Copy link
Contributor

Hello @apolikamixitos : Can you rebase off of the latest develop branch?

@apolikamixitos apolikamixitos force-pushed the add_github_list_pr branch 2 times, most recently from d383b3e to 4df8aac Compare February 14, 2017 11:52
github/plugin.py Outdated Show resolved Hide resolved
github/plugin.py Outdated Show resolved Hide resolved
github/plugin.py Outdated Show resolved Hide resolved
github/plugin.py Outdated Show resolved Hide resolved
assignee = pr['assignee']['login'] if pr['assignee'] is not None else '-'
rows.append([pr['number'],pr['title'], pr['user']['login'], assignee,pr['state'].title()])
# Done:
send_raw(data["channel"], text="Repository: *{}* \n\n```{}```".format(reponame, tabulate(rows, headers=headers, tablefmt='orgtbl')))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious to see what this will look like. I typically send messages as attachments so I can use Markdown for formatting. However, this is perfectly fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how it looks on attachments:

screen shot 2017-02-14 at 10 10 24 pm

If we send it as a raw text, the table is displayed correctly:

screen shot 2017-02-14 at 10 10 41 pm

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat!

'Accept': GITHUB_VERSION
}

api_part = 'repos/{}/{}/pulls?state={}'.format(org, repo, state)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a paginated API. Should we only list the default number?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for a first version we can go with the default limit, and since the practical usage will be usually just to quick check the most recent PRs (open, closed).

For advanced usage, the user might be interested to perform his actions on the Github search engine directly ...

@mikegrima mikegrima merged commit 93a97d1 into Netflix:develop Feb 15, 2017
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.

3 participants