Code Monkey home page Code Monkey logo

Comments (6)

emilyriederer avatar emilyriederer commented on August 22, 2024 1

Thanks @Bartesto -- that's great to hear! Please keep me posted if you have any other bugs or feature requests as you try it out! Always happy for new ideas.

from projmgr.

emilyriederer avatar emilyriederer commented on August 22, 2024

Hi @Bartesto ! I'm wondering if something in the YAML itself is getting parsed wrong. If you have an example that you can share, I'd love to try running it.

from projmgr.

Bartesto avatar Bartesto commented on August 22, 2024

Hi @emilyriederer. Sorry not at work at the moment but I was just following along with the "Generating Milestones & Issues form YAML" article on the package website using your example shipped with the package. I had tried using my own example using the template_yaml but got the same error. I then tried using your example thinking I'd got the yaml format wrong but got the same error. I'll get you a reprex in a couple of days.

from projmgr.

Bartesto avatar Bartesto commented on August 22, 2024

Hi @emilyriederer. So in the below I am copying your function calls from the "Generating Milestones..." article. The only changes were creating a repo ref to my own and making "Bartesto" the assignees. All outputs are mine.

Started with the plan.yml that comes with package

plan_path <- system.file("extdata", "plan.yml", package = "projmgr", mustWork = TRUE)
my_plan <- read_plan(plan_path)
str(my_plan)
# List of 2
#  $ :List of 4
#   ..$ title      : chr "Data cleaning and validation"
#   ..$ description: chr "We will conduct data quality checks, resolve issues with data quality, and document this process\n"
#   ..$ due_on     : chr "2018-12-31T12:59:59Z"
#   ..$ issue      :List of 3
#   .. ..$ :List of 4
#   .. .. ..$ title    : chr "Define data quality standards"
#   .. .. ..$ body     : chr "List out decision rules to check data quality"
#   .. .. ..$ assignees: chr "emilyriederer"
#   .. .. ..$ labels   : chr [1:3] "a" "b" "c"
#   .. ..$ :List of 3
#   .. .. ..$ title : chr "Assess data quality"
#   .. .. ..$ body  : chr "Use assertthat to test decision rules on dataset"
#   .. .. ..$ labels: chr "low"
#   .. ..$ :List of 2
#   .. .. ..$ title: chr "Resolve data quality issues"
#   .. .. ..$ body : chr "Conduct needed research to resolve any issues"
#  $ :List of 3
#   ..$ title      : chr "Exploratory data analysis"
#   ..$ description: chr "Create basic statistics and views to better understand dataset and relationships\n"
#   ..$ issue      :List of 2
#   .. ..$ :List of 2
#   .. .. ..$ title: chr "Summary statistics"
#   .. .. ..$ body : chr "Calculate summary statistics"
#   .. ..$ :List of 2
#   .. .. ..$ title: chr "Visualizations"
#   .. .. ..$ body : chr "Create univariate and bivariate plots"
#  - attr(*, "class")= chr [1:2] "plan" "list"

## change assignees to me
my_plan[1][[1]]$issue[[1]]$assignees <- "Bartesto"

print(my_plan)
# Plan: 
# 1. Data cleaning and validation (3 issues) 
# 2. Exploratory data analysis (2 issues)

## create own repo ref
experigit <- create_repo_ref("Bartesto", "rivRmon_development")
# Requests will authenticate with GITHUB_PAT

check_credentials(experigit)
# -- With provided credentials -- 
# + Login: Bartesto
# + Type: User
# -- In the rivRmon_development repo -- 
# + Admin: TRUE
# + Push: TRUE
# + Pull: TRUE

post_plan(experigit, my_plan)
# Error in gh_process_response(raw) : 
# GitHub API error (422): 422 Unprocessable Entity
# Message: Invalid request.

# "per_page" is not a permitted key.
# Read more at https://developer.github.com/v3/issues/milestones/#create-a-milestone

Next I tried the yaml as character string

plan_yaml_vbl <- "
milestone1:
  title: First draft
  body: Complete the first draft of this paper for review

milestone2:
  title: Make revisions
  body: Repsond to feedback from reviewers
"
plan_from_vbl <- read_plan(plan_yaml_vbl)
str(plan_from_vbl)
# List of 2
#  $ milestone1:List of 2
#   ..$ title: chr "First draft"
#   ..$ body : chr "Complete the first draft of this paper for review"
#  $ milestone2:List of 2
#   ..$ title: chr "Make revisions"
#   ..$ body : chr "Repsond to feedback from reviewers"
#  - attr(*, "class")= chr [1:2] "plan" "list"

post_plan(experigit, plan_from_vbl)
# Error in gh_process_response(raw) : 
# GitHub API error (422): 422 Unprocessable Entity
# Message: Invalid request.

# "per_page" is not a permitted key.
# Read more at https://developer.github.com/v3/issues/milestones/#create-a-milestone

Next I tried creating a yaml file to read in locally. I simply copied the output from template_yaml("plan) and saved as "template_yaml.yml"

template_yaml("plan")
# created a yaml called template_yaml.yml without adding anything
my_plan2 <- read_plan("./template_yaml.yml")
str(my_plan2)
# List of 2
#  $ :List of 4
#   ..$ title      : chr "Enter a short, informative title of your goal"
#   ..$ description: chr "Enter a longer description of the objectives\n"
#   ..$ due_on     : chr "2018-12-31T12:59:59Z"
#   ..$ issue      :List of 2
#   .. ..$ :List of 4
#   .. .. ..$ title    : chr "Title of task 1 to complete"
#   .. .. ..$ body     : chr "Describe this step"
#   .. .. ..$ assignees: chr "emilyriederer"
#   .. .. ..$ labels   : chr [1:3] "a" "b" "c"
#   .. ..$ :List of 3
#   .. .. ..$ title : chr "Title of task 2 to complete"
#   .. .. ..$ body  : chr "Describe this step"
#   .. .. ..$ labels: chr "low"
#  $ :List of 3
#   ..$ title      : chr "Enter another short, informative title of your goal"
#   ..$ description: chr "Enter a longer description of the objectives\n"
#   ..$ issue      :List of 2
#   .. ..$ :List of 2
#   .. .. ..$ title: chr "Title of task 1 to complete for step 2"
#   .. .. ..$ body : chr "Describe this step"
#   .. ..$ :List of 2
#   .. .. ..$ title: chr "Title of task 2 to complete for step 2"
#   .. .. ..$ body : chr "Describe this step"
#  - attr(*, "class")= chr [1:2] "plan" "list"

print(my_plan2)
# Plan: 
# 1. Enter a short, informative title of your goal (2 issues) 
# 2. Enter another short, informative title of your goal (2 issues) 

post_plan(experigit, my_plan2)
# Error in gh_process_response(raw) : 
# GitHub API error (422): 422 Unprocessable Entity
# Message: Invalid request.

# "per_page" is not a permitted key.
# Read more at https://developer.github.com/v3/issues/milestones/#create-a-milestone

I have had success with the "todo" example that comes with the package (changing the assignees as above). It's got me stumped as I'm sure the GITHUB_PAT is fine as I can read issues from one of my other repos and also post issues there too.

My session info:

sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252   
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C                      
[5] LC_TIME=English_Australia.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] projmgr_0.1.0

loaded via a namespace (and not attached):
 [1] httr_1.4.1       compiler_3.5.2   R6_2.4.1         assertthat_0.2.1
 [5] magrittr_1.5     cli_2.0.1        tools_3.5.2      glue_1.3.1      
 [9] rstudioapi_0.11  curl_4.3         yaml_2.2.1       crayon_1.3.4    
[13] gh_1.1.0         fansi_0.4.1      jsonlite_1.6.1   packrat_0.5.0  

from projmgr.

emilyriederer avatar emilyriederer commented on August 22, 2024

Hi @Bartesto ! Thank you so much for reporting, all the sleuthing on your end, and the great reprex. These were super helpful in isolating the issue. Specifically, knowing that todo was working and plan wasn't gave me a good sense that the problem was coming from the milestones and not the issues, and the sessionInfo() it jumped out to me that your gh package version was newer than mine. When I upgraded my gh, I was able to replicate the error you were getting.

Long story short, I've pushed a change that has resolved the issue on my end. Can you please try the following and see if it helps you too?

devtools::install_github('emilyriederer/projmgr', ref = 'next-release')
library(projmgr)
plan_path <- system.file("extdata", "plan.yml", package = "projmgr", mustWork = TRUE)
my_plan <- read_plan(plan_path)
repo <- create_repo_ref('emilyriederer', 'experigit')
post_plan(repo, my_plan)

Thank you again so much for reporting and all of the help debugging!

from projmgr.

Bartesto avatar Bartesto commented on August 22, 2024

Hi @emilyriederer. Success!! Thanks for for sorting out. I have a current project that is just begging to be reported through your package. Glad my very long reprex helped.
Cheers
Bart

from projmgr.

Related Issues (20)

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.