Skip to content

Commit

Permalink
do not insert gh_token header on gh workflow runs
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Nov 13, 2024
1 parent 077c7c4 commit 8897803
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: githist
Title: Code analyses traced along the 'git' history of a package
Version: 0.1.0.047
Version: 0.1.0.048
Authors@R:
person("Mark", "Padgham", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-2172-5265"))
Expand Down
11 changes: 7 additions & 4 deletions R/gh-queries.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ github_repo_workflow_query <- function (org = NULL, repo = NULL, n = 30L) {
u_repo <- paste0 (u_base, org, "/", repo, "/")
u_wf <- paste0 (u_repo, "actions/runs?per_page=", n)

tok <- get_gh_token ()
headers <- list (Authorization = paste0 ("Bearer ", tok))
req <- httr2::request (u_wf)

if (!nzchar (Sys.getenv ("GITHUB_WORKFLOW"))) {
tok <- get_gh_token ()
headers <- list (Authorization = paste0 ("Bearer ", tok))
req <- httr2::req_headers (req, "Authorization" = headers)

Check warning on line 44 in R/gh-queries.R

View check run for this annotation

Codecov / codecov/patch

R/gh-queries.R#L42-L44

Added lines #L42 - L44 were not covered by tests
}

req <- httr2::request (u_wf) |>
httr2::req_headers ("Authorization" = headers)
resp <- httr2::req_perform (req)
httr2::resp_check_status (resp)

Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"codeRepository": "https://github.com/ropensci-review-tools/githist",
"issueTracker": "https://github.com/ropensci-review-tools/githist/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.1.0.047",
"version": "0.1.0.048",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down

0 comments on commit 8897803

Please sign in to comment.