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

PATs need to have scopes #42

Open
willwheels opened this issue May 20, 2020 · 1 comment
Open

PATs need to have scopes #42

willwheels opened this issue May 20, 2020 · 1 comment

Comments

@willwheels
Copy link

I've really enjoyed spinning the wheels on this package, it seems very useful. I ran into trouble when first trying it. It appears that when creating a PAT, you need to check some of the boxes for correct authorization. I think this only requires a tiny change to the article (
https://emilyriederer.github.io/projmgr/articles/github-pat.html)

I apologize if the reprexes are too long, I was trying to be thorough. This is with a PAT with no scope boxes checked.

library(projmgr)

cfr_plan_txt <- "
- title: 2009 is a problem
  description: >
    The 2009 files continue to display weird results
  issue:
    - title: Investigate issue
      body: Not sure about path
      assignees: [willwheels]
      labels: [long-term]


- title: Redo network
  description: >
    Recreate network with tidygraph; do all data steps in initial dataframe
  issue:
    - title: Remove igraph steps
      body: nuke igraph
    - title: Move data steps
      body: Move all weight and size calculations to data frame creation
    - title: Visualizations
      body: recreate network visualizations"

cfr_plan <- read_plan(cfr_plan_txt)

cfr_repo_ref <- create_repo_ref("willwheels", "CFR")
#> Requests will authenticate with GITHUB_PAT

check_credentials(cfr_repo_ref)
#> -- With provided credentials -- 
#> + Login: willwheels
#> + Type: User
#> -- In the CFR repo -- 
#> + Admin: FALSE
#> + Push: FALSE
#> + Pull: FALSE

cfr_plan
#> Plan: 
#> 1. 2009 is a problem (1 issues) 
#> 2. Redo network (3 issues)

cfr_repo_ref
#> + Repository Owner: willwheels
#> + Repository: CFR
#> + From URL: https://api.github.com/
#> + Authenticating with: GITHUB_PAT

post_plan(cfr_repo_ref, cfr_plan)
#> Error in gh::gh(endpoint = paste0(ref$base_url, ref$repo_path, api_endpoint), : GitHub API error (404): 404 Not Found
#>   Not Found

Created on 2020-05-20 by the reprex package (v0.3.0)

Then, created a new PAT, checking the boxes for "repo" and "workflow" and it worked:

library(projmgr)

cfr_plan_txt <- "
- title: 2009 is a problem
  description: >
    The 2009 files continue to display weird results
  issue:
    - title: Investigate issue
      body: Not sure about path
      assignees: [willwheels]
      labels: [long-term]


- title: Redo network
  description: >
    Recreate network with tidygraph; do all data steps in initial dataframe
  issue:
    - title: Remove igraph steps
      body: nuke igraph
    - title: Move data steps
      body: Move all weight and size calculations to data frame creation
    - title: Visualizations
      body: recreate network visualizations"

cfr_plan <- read_plan(cfr_plan_txt)

cfr_repo_ref <- create_repo_ref("willwheels", "CFR")
#> Requests will authenticate with GITHUB_PAT

check_credentials(cfr_repo_ref)
#> -- With provided credentials -- 
#> + Login: willwheels
#> + Type: User
#> -- In the CFR repo -- 
#> + Admin: TRUE
#> + Push: TRUE
#> + Pull: TRUE

cfr_plan
#> Plan: 
#> 1. 2009 is a problem (1 issues) 
#> 2. Redo network (3 issues)

cfr_repo_ref
#> + Repository Owner: willwheels
#> + Repository: CFR
#> + From URL: https://api.github.com/
#> + Authenticating with: GITHUB_PAT

post_plan(cfr_repo_ref, cfr_plan)
#>   milestone_number   milestone_title issue_number         issue_title
#> 1                1 2009 is a problem            5   Investigate issue
#> 2                2      Redo network            6 Remove igraph steps
#> 3                2      Redo network            7     Move data steps
#> 4                2      Redo network            8      Visualizations

Created on 2020-05-20 by the reprex package (v0.3.0)

@emilyriederer
Copy link
Owner

Thanks so much @willwheels ! This is a great point. I will definitely update the documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants