-
Notifications
You must be signed in to change notification settings - Fork 13
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
Create github.R #301
Open
Ssunoo2
wants to merge
3
commits into
master
Choose a base branch
from
298-github-refresh-script
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Create github.R #301
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same on revert to master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
#!/usr/local/bin/Rscript | ||
|
||
# Kaiaulu - https://github.com/sailuh/kaiaulu | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
require(yaml,quietly=TRUE) | ||
require(cli,quietly=TRUE) | ||
require(docopt,quietly=TRUE) | ||
require(kaiaulu,quietly=TRUE) | ||
require(data.table,quietly=TRUE) | ||
require(jsonlite,quietly=TRUE) | ||
require(knitr,quietly=TRUE) | ||
require(magrittr,quietly=TRUE) | ||
require(gt,quietly=TRUE) | ||
|
||
|
||
# Rscript github.R refresh issues ../../kaiaulu/conf/kaiaulu.yml ../../rawdata/github/kaiaulu/issue_search/ | ||
# Rscript github.R refresh comments ../../kaiaulu/conf/kaiaulu.yml ../../rawdata/github/kaiaulu/issue_search/ | ||
|
||
doc <- " | ||
USAGE: | ||
github refresh help | ||
github refresh issues <project_conf.yml> <save_file_name_path> | ||
github refresh comments <project_conf.yml> <save_file_name_path> | ||
github download Github help | ||
github (-h | --help) | ||
github --version | ||
|
||
DESCRIPTION: | ||
Provides functions to refresh Github issue data. Please see | ||
Kaiaulu's README.md for instructions on how to create <project_conf.yml>. | ||
|
||
|
||
OPTIONS: | ||
-h --help Show this screen. | ||
--version Show version. | ||
" | ||
|
||
|
||
|
||
arguments <- docopt::docopt(doc, version = 'Kaiaulu 0.0.0.9600') | ||
if(arguments[["refresh"]] & arguments[["help"]]){ | ||
cli_alert_info("Downloads new data from Github Rest API") | ||
}else if(arguments[["refresh"]] & arguments [["issues"]]){ | ||
|
||
conf_path <- arguments[["<project_conf.yml>"]] | ||
save_path <- arguments[["<save_file_name_path>"]] | ||
|
||
conf <- yaml::read_yaml(conf_path) | ||
|
||
save_path <- path.expand(conf[["issue_tracker"]][["github"]][["replies"]]) | ||
save_path_issue_refresh <- paste0(save_path,"/issue_search/") | ||
save_path_issue <- paste0(save_path,"/issue/") | ||
save_path_issue_or_pr_comments <- paste0(save_path,"/issue_or_pr_comment/") | ||
# Path you wish to save all raw data. A folder with the repo name and sub-folders will be created. | ||
owner <- conf[["issue_tracker"]][["github"]][["owner"]] # Has to match github organization (e.g. github.com/sailuh) | ||
repo <- conf[["issue_tracker"]][["github"]][["repo"]] # Has to match github repository (e.g. github.com/sailuh/perceive) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hardcoded get |
||
# your file github_token (a text file) contains the GitHub token API | ||
token <- scan("~/.ssh/github_token",what="character",quiet=TRUE) | ||
|
||
gh_response <- github_api_project_issue_refresh(owner, | ||
repo, | ||
token, | ||
save_path_issue_refresh, | ||
verbose=TRUE) | ||
github_api_iterate_pages(token,gh_response, | ||
save_path_issue_refresh, | ||
prefix="issue", | ||
verbose=TRUE) | ||
|
||
cli_alert_success(paste0("Downloaded new Github issues saved at: ",save_path_issue_refresh)) | ||
}else if(arguments[["refresh"]] & arguments [["comments"]]){ | ||
|
||
conf <- yaml::read_yaml("../conf/kaiaulu.yml") | ||
save_path <- path.expand(conf[["issue_tracker"]][["github"]][["replies"]]) | ||
save_path_issue_or_pr_comments <- paste0(save_path,"/issue_or_pr_comment/") | ||
# Path you wish to save all raw data. A folder with the repo name and sub-folders will be created. | ||
owner <- conf[["issue_tracker"]][["github"]][["owner"]] # Has to match github organization (e.g. github.com/sailuh) | ||
repo <- conf[["issue_tracker"]][["github"]][["repo"]] # Has to match github repository (e.g. github.com/sailuh/perceive) | ||
# your file github_token (a text file) contains the GitHub token API | ||
token <- scan("~/.ssh/github_token",what="character",quiet=TRUE) | ||
|
||
gh_response_issue_or_pr_comment <- github_api_project_issue_or_pr_comment_refresh(owner, | ||
repo, | ||
token, save_path_issue_or_pr_comments, verbose=TRUE) | ||
|
||
# create directory and iterate over data | ||
#dir.create(save_path_issue_or_pr_comments) | ||
github_api_iterate_pages(token,gh_response_issue_or_pr_comment, | ||
save_path_issue_or_pr_comments, | ||
prefix="issue_or_pr_comment", | ||
verbose=TRUE) | ||
} | ||
|
||
|
||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure you revert this or sync to master