@@ -20,6 +20,84 @@ python -m pip install .
2020
2121## Usage
2222
23+ ### Authentication
24+
25+ All functions require a GitHub personal access token with appropriate
26+ permissions.
27+
28+ You will need to set it as an environment variable:
29+
30+ ``` bash
31+ export GITHUB_TOKEN=your_token_here
32+ ```
33+
34+ ### Functions
35+
36+ All functions return a pandas DataFrame and accept an optional ` save ` argument.
37+
38+ - Setting ` save=True ` will cause the data to be saved to ` data/ `
39+ - Setting ` save="path/to/file.csv" ` will cause the data to be saved to the
40+ specified path.
41+
42+ ** Org-level data:**
43+
44+ ``` python
45+ from github_analyser.org_user_info import get_org_members, get_org_teams
46+ from github_analyser.repos import get_repos
47+
48+ # list all repositories in an organisation
49+ repos = get_repos(" my-org" )
50+
51+ # list all members of an organisation
52+ members = get_org_members(" my-org" )
53+
54+ # list all teams in an organisation
55+ teams = get_org_teams(" my-org" )
56+ ```
57+
58+ ** Team and repo-level data:**
59+
60+ ``` python
61+ from github_analyser.team_user_info import get_team_members
62+ from github_analyser.repo_user_info import get_repo_collaborators
63+ from github_analyser.repo_contributors import get_repo_contributors
64+ from github_analyser.commits import get_commits
65+ from github_analyser.issues import get_issues
66+ from github_analyser.pull_requests import get_pull_requests
67+ from github_analyser.licences import get_licences
68+
69+ # list members of a team (use the team slug, e.g. "my-team")
70+ members = get_team_members(" my-org" , " my-team" )
71+
72+ # list collaborators of a repository
73+ collaborators = get_repo_collaborators(" my-org" , " my-repo" )
74+
75+ # get contributor commit counts for a repository
76+ contributors = get_repo_contributors(" my-org" , " my-repo" )
77+
78+ # get commits from the default branch of a repository
79+ commits = get_commits(" my-org" , " my-repo" )
80+
81+ # get issues from a repository
82+ issues = get_issues(" my-org" , " my-repo" )
83+
84+ # get pull requests from a repository
85+ prs = get_pull_requests(" my-org" , " my-repo" )
86+
87+ # get licence information for one or more repositories
88+ licences = get_licences(" my-org" , [" repo-one" , " repo-two" ])
89+ ```
90+
91+ ** Saving results to CSV:**
92+
93+ ``` python
94+ # save to the default path
95+ repos = get_repos(" my-org" , save = True )
96+
97+ # save to a custom path
98+ repos = get_repos(" my-org" , save = " output/repos.csv" )
99+ ```
100+
23101## Contributing
24102
25103See [ CONTRIBUTING.md] ( CONTRIBUTING.md ) for instructions on how to contribute.
0 commit comments