New Upstream Snapshot - r-cran-sessioninfo

Ready changes

Summary

Merged new upstream version: 1.2.2+git20220701.1.0d74fe9 (was: 1.2.2).

Resulting package

Built on 2023-01-19T05:58 (took 6m47s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-snapshots r-cran-sessioninfo

Lintian Result

Diff

diff --git a/DESCRIPTION b/DESCRIPTION
index c0046a1..3641f2e 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,52 +1,41 @@
 Package: sessioninfo
 Title: R Session Information
-Version: 1.2.2
-Authors@R: 
-    c(person(given = "Gábor",
-             family = "Csárdi",
-             role = "cre",
-             email = "csardi.gabor@gmail.com"),
-      person(given = "Hadley",
-             family = "Wickham",
-             role = "aut"),
-      person(given = "Winston",
-             family = "Chang",
-             role = "aut"),
-      person(given = "Robert",
-             family = "Flight",
-             role = "aut"),
-      person(given = "Kirill",
-             family = "Müller",
-             role = "aut"),
-      person(given = "Jim",
-             family = "Hester",
-             role = "aut"),
-      person(given = "R Core team",
-             role = "ctb"))
+Version: 1.2.2.9000
+Authors@R: c(
+    person("Gábor", "Csárdi", , "csardi.gabor@gmail.com", role = "cre"),
+    person("Hadley", "Wickham", role = "aut"),
+    person("Winston", "Chang", role = "aut"),
+    person("Robert", "Flight", role = "aut"),
+    person("Kirill", "Müller", role = "aut"),
+    person("Jim", "Hester", role = "aut"),
+    person("R Core team", role = "ctb"),
+    person("RStudio Pbc", role = c("cph", "fnd"))
+  )
 Maintainer: Gábor Csárdi <csardi.gabor@gmail.com>
-Description: Query and print information about the current R
-    session.  It is similar to 'utils::sessionInfo()', but includes more
-    information about packages, and where they were installed from.
+Description: Query and print information about the current R session.  It
+    is similar to 'utils::sessionInfo()', but includes more information
+    about packages, and where they were installed from.
 License: GPL-2
 URL: https://github.com/r-lib/sessioninfo#readme,
         https://r-lib.github.io/sessioninfo/
 BugReports: https://github.com/r-lib/sessioninfo/issues
-Depends: R (>= 2.10)
+Depends: R (>= 3.4)
 Imports: cli (>= 3.1.0), tools, utils
-Suggests: callr, covr, mockery, reticulate, rmarkdown, testthat, withr
-Encoding: UTF-8
-RoxygenNote: 7.1.2.9000
+Suggests: callr, covr, gh, mockery, reticulate, rmarkdown, testthat,
+        withr
+Config/Needs/website: pkgdown, tidyverse/tidytemplate
 Config/testthat/edition: 3
-Config/Needs/website: pkgdown
 Config/testthat/parallel: true
+Encoding: UTF-8
+Roxygen: list(markdown = TRUE)
+RoxygenNote: 7.1.2.9000
 NeedsCompilation: no
-Packaged: 2021-12-06 11:31:46 UTC; gaborcsardi
+Packaged: 2023-01-19 05:55:19 UTC; root
 Author: Gábor Csárdi [cre],
   Hadley Wickham [aut],
   Winston Chang [aut],
   Robert Flight [aut],
   Kirill Müller [aut],
   Jim Hester [aut],
-  R Core team [ctb]
-Repository: CRAN
-Date/Publication: 2021-12-06 11:50:02 UTC
+  R Core team [ctb],
+  RStudio Pbc [cph, fnd]
diff --git a/MD5 b/MD5
deleted file mode 100644
index 139b176..0000000
--- a/MD5
+++ /dev/null
@@ -1,56 +0,0 @@
-4de58a4c8ba4cf275b3c6e2bdb7c8f9e *DESCRIPTION
-c1a316fbe0914a8550965ad64113bb38 *NAMESPACE
-7036cbf831ce4482537ac5296224edeb *NEWS.md
-cc07f49e618b81dd45bccb8bcd366019 *R/clipboard.R
-a7f2ee188bd33b24daa377b06047b440 *R/compare.R
-94bd6140788030074319ff1c3c08bad3 *R/dependent-packages.R
-872982992113b732cacf4476af221dd6 *R/external-info.R
-7bdd14fbb1151bad94895d78b936d32c *R/loaded-packages.R
-7a250a529661d3f47169f5e670946d2e *R/osname.R
-2ca572682db6ead691bcef299c56e931 *R/package-info.R
-c11f0f7253128318b438ff3cd44c2508 *R/platform-info.R
-a500c1a3d23c5caf1dabc8e2fcecae6a *R/printing.R
-fe51563c6b6575d0d5196d6cde098133 *R/python-info.R
-260e9f54b6f663b907494ad53dd14d53 *R/rematch2.R
-b550e29bac96ae73bc4b451afd35b263 *R/session-info.R
-0f2234321806b6aebc927281c55c6e76 *R/sysdata.rda
-9e23d84a70cca80be5c417e2745552fa *R/utils.R
-57640d2ee6f4544d7050a0673e5b10f0 *README.md
-d9e5097113b41a5f415deda6b9b17832 *man/external_info.Rd
-46c3a8eed9461d759ef19397193f52a2 *man/figures/session-info2.svg
-f013297d5c2f3006735392a759a84b9e *man/os_name.Rd
-8e43efe349c360f925526d478a90d645 *man/package_info.Rd
-af284b52558ec10d45166c9ec1f8c923 *man/platform_info.Rd
-08b11a60cc2c6189d7249ea36595cd54 *man/python_info.Rd
-9513781d5b75ee0a21a0f02fbd7c5e58 *man/session_diff.Rd
-2f429bc09be5886e5c5d79eac777d0d0 *man/session_info.Rd
-0e823279172bfb7590ddf30053becad9 *tests/testthat.R
-47fc217e5a616725a486302c3632f671 *tests/testthat/_snaps/diff.md
-d1570db3da339a5bb3db7c85673f984f *tests/testthat/fixtures/MD5
-ed4e99dfc45e8190839ec97ee3bbd655 *tests/testthat/fixtures/biobase.rda
-23aa7627516d2e036556771d4e444e84 *tests/testthat/fixtures/descs.rda
-2ec46780c0a6b9b42f84b87fec7aac43 *tests/testthat/fixtures/devtools-deps.rda
-c538f1d48dabb29bde6847a1aa0f11db *tests/testthat/fixtures/devtools-info-unix.rda
-4142c8cc868e97273cd00ccd7168bf0d *tests/testthat/fixtures/devtools-info-windows.rda
-b0297cc88f9e44fb164a4d74e5f7c650 *tests/testthat/fixtures/devtools.rda
-bcef3a0e2f95c7ee4e5dce665d0ce603 *tests/testthat/fixtures/fsdfgwetdhsdfhq4yqh_0.0.0.9000.tar.gz
-af3e2fe7bb2a58d80104b73b70539bf5 *tests/testthat/fixtures/gh.html.gz
-e33873feb91bc7e55254cb0163048920 *tests/testthat/fixtures/installed.rda
-7515f53060f9724e47c093dba5487141 *tests/testthat/fixtures/lines1.txt
-1abcab5ec2911f7e305053e64bf17605 *tests/testthat/fixtures/lines2.txt
-264c91bc5e6e1490b167849ee1f78d04 *tests/testthat/fixtures/lines3.txt
-14bab53560a4f2f79d0f3c5b99e0d868 *tests/testthat/fixtures/lines4.txt
-19bee1c35412de7d79c770fd0c3b03dd *tests/testthat/fixtures/memoise.rda
-8b73286945f1227d87894c240d55debf *tests/testthat/fixtures/no-remote-repo.rda
-2b97d22ff72bfb169197214a58f0dc0e *tests/testthat/fixtures/no-sha.rda
-e7a38f6ef9d4804f81221fabd41ec27b *tests/testthat/test-dependent-packages.R
-755bd174e447411f582642a95b232362 *tests/testthat/test-diff.R
-adc988c381a23fd634e6d5dbde4f0a71 *tests/testthat/test-loaded-packages.R
-8f17943cf5b6008973d719ee39528728 *tests/testthat/test-os-name.R
-9dc5e8c248b2e294ef26a59756e6f96b *tests/testthat/test-package-info.R
-6fc2a8c25e7e200142d5b60d10b8611f *tests/testthat/test-platform-info.R
-ef86c54a0d4694229521540c9a6ef4a0 *tests/testthat/test-printing.R
-9d33f770f648b4018c9abc010a770a5f *tests/testthat/test-session-info.R
-e6919f3534f256386cf7205981e3e713 *tests/testthat/test-utils.R
-1fba4c15191c361814e05b1ca074725b *tests/testthat/test-warnings.R
-bfd31e2e45480fe56637ff10b18db692 *tools/bad-emoji.R
diff --git a/NEWS.md b/NEWS.md
index 008cd63..dd14df5 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,4 +1,9 @@
 
+# development version
+
+* `session_diff()` now accepts the URL to a GitHub Actions log as the source for
+  `new` and/or `old` (@jennybc, #68).
+
 # 1.2.2
 
 * This version does not add an emoji hash to the output.
diff --git a/R/compare.R b/R/compare.R
index ac8d99e..6ede2aa 100644
--- a/R/compare.R
+++ b/R/compare.R
@@ -14,9 +14,15 @@
 #' * `"clipboard"` takes the session info from the system clipboard.
 #'   If the clipboard contains a URL, it is followed to download the
 #'   session info.
-#' * A URL starting with `http://` or `https://`. `session_diff` searches
-#'   the HTML (or text) page for the session info header to find the session
-#'   info.
+#' * The URL where you inspect the results for a GitHub Actions job.
+#'   Typically has this form:
+#'   ```
+#'   https://github.com/OWNER/REPO/runs/JOB_ID?check_suite_focus=true
+#'   ```
+#' * Any other URL starting with `http://` or `https://`. `session_diff()`
+#'   searches the HTML (or text) page for the session info header to find the
+#'   session info.
+#'
 #'
 #' @export
 #' @examplesIf FALSE
@@ -61,6 +67,8 @@ get_session_info <- function(src, name = NULL, ...) {
     get_session_info_local(...)
   } else if (is_string(src) == 1 && src == "clipboard") {
     get_session_info_clipboard()
+  } else if (is_string(src) && is_gha_url(src)) {
+    get_session_info_gha(src)
   } else if (is_string(src) && grepl("https?://", src)) {
     get_session_info_url(src)
   } else {
diff --git a/R/github-actions.R b/R/github-actions.R
new file mode 100644
index 0000000..6646567
--- /dev/null
+++ b/R/github-actions.R
@@ -0,0 +1,89 @@
+# taken from usethis
+# definitely designed for GitHub URLs but not overtly GitHub-specific
+# https://stackoverflow.com/questions/2514859/regular-expression-for-git-repository
+# https://git-scm.com/docs/git-clone#_git_urls
+# https://stackoverflow.com/questions/27745/getting-parts-of-a-url-regex
+github_url_regex <- paste0(
+  "^",
+  "(?<protocol>\\w+://)?",
+  "(?<user>.+@)?",
+  "(?<host>[^/:]+)",
+  "[/:]",
+  "(?<repo_owner>[^/]+)",
+  "/",
+  "(?<repo_name>[^/#]+)",
+  "(?<fragment>.*)",
+  "$"
+)
+
+parse_as_gha_url <- function(url) {
+  res <- re_match(url, github_url_regex)$groups
+  res$job_id <- re_match(res$fragment, "^/runs/(?<job_id>[0-9]+).*")$groups$job_id
+
+  ok <- res$host %in% "github.com" &
+    !is.na(res$repo_owner) & !is.na(res$repo_name) &!is.na(res$job_id)
+
+  data.frame(
+    owner  = ifelse(ok, res$repo_owner, NA_character_),
+    repo   = ifelse(ok, res$repo_name, NA_character_),
+    job_id = ifelse(ok, res$job_id, NA_character_),
+    stringsAsFactors = FALSE,
+    row.names = NULL
+  )
+}
+
+is_gha_url <- function(url) {
+  res <- parse_as_gha_url(url)
+  !is.na(res$job_id)
+}
+
+get_session_info_gha <- function(url) {
+  if (!requireNamespace("gh", quietly = TRUE)) {
+    stop(
+      "The gh package is not available.\n",
+      "This appears to be the URL for a GitHub Actions (GHA) log:\n",
+      url, "\n",
+      "You must install the gh package to get session info for GHA job logs."
+    )
+  }
+
+  dat <- parse_as_gha_url(url)
+  meta <- gh::gh(
+    "/repos/{owner}/{repo}/actions/jobs/{job_id}",
+    owner = dat$owner, repo = dat$repo, job_id = dat$job_id
+  )
+  raw_log <- gh::gh(
+    "/repos/{owner}/{repo}/actions/jobs/{job_id}/logs",
+    owner = dat$owner, repo = dat$repo, job_id = dat$job_id
+  )
+  timestamped_lines <- unlist(strsplit(raw_log$message, split = "\r\n"))
+  lines <- sub("^[^\\s]+\\s+", "", timestamped_lines, perl = TRUE)
+
+  re_start <- "[-=\u2500\u2550][ ]Session info[ ]"
+  cand <- grep(re_start, lines)
+  if (length(cand) == 0) stop("Cannot find session info at '", url, "'.")
+  lines <- lines[cand[1]:length(lines)]
+  lines[1] <- sub(paste0("^.*(", re_start, ")"), "\\1", lines[1])
+
+  grepl_end <- function(lines) {
+    grepl("^[ ]*\\[[0-9]\\] ", lines) |
+      grepl("^[ ]*[-\u2500]+$", lines)
+  }
+  end <- which(grepl_end(lines))[1]
+  if (is.na(end)) stop("Cannot parse session info from '", url, "'.")
+  while (end < length(lines) && grepl_end(lines[end + 1])) {
+    end <- end + 1
+  }
+
+  si <- get_session_info_literal(lines[1:end])
+
+  si$arg <- "github-actions"
+  si$name <- paste(
+    meta$name,
+    meta$conclusion,
+    paste("job", meta$id),
+    paste("run", meta$run_id),
+    sep = " | "
+  )
+  si
+}
diff --git a/R/sessioninfo-package.R b/R/sessioninfo-package.R
new file mode 100644
index 0000000..a65cf64
--- /dev/null
+++ b/R/sessioninfo-package.R
@@ -0,0 +1,6 @@
+#' @keywords internal
+"_PACKAGE"
+
+## usethis namespace: start
+## usethis namespace: end
+NULL
diff --git a/README.md b/README.md
index fd93f08..85648c8 100644
--- a/README.md
+++ b/README.md
@@ -5,10 +5,10 @@
 
 <!-- badges: start -->
 [![Lifecycle: stable](https://lifecycle.r-lib.org/articles/figures/lifecycle-stable.svg)](https://lifecycle.r-lib.org/articles/stages.html)
-[![R build status](https://github.com/r-lib/sessioninfo/workflows/R-CMD-check/badge.svg)](https://github.com/r-lib/sessioninfo/actions)
+[![R-CMD-check](https://github.com/r-lib/sessioninfo/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/sessioninfo/actions/workflows/R-CMD-check.yaml)
 [![](https://www.r-pkg.org/badges/version/sessioninfo)](https://www.r-pkg.org/pkg/sessioninfo)
 [![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/sessioninfo)](https://www.r-pkg.org/pkg/sessioninfo)
-[![Coverage Status](https://img.shields.io/codecov/c/github/r-lib/sessioninfo/master.svg)](https://codecov.io/github/r-lib/sessioninfo?branch=master)
+[![Codecov test coverage](https://codecov.io/gh/r-lib/sessioninfo/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-lib/sessioninfo?branch=main)
 <!-- badges: end -->
 
 Query and print information about the current R session. It is similar to
@@ -26,7 +26,7 @@ where they were installed from.
   etc.
 * Highlight packages from unusual sources.
 * Information about external software via `external_info()`.
-* Information about the Python configuration is the reticulate package is
+* Information about the Python configuration if the reticulate package is
   loaded and configured.
 * Information about package libraries.
 * Compare two session info outputs with the `session_diff()` function.
@@ -208,6 +208,12 @@ sessioninfo::session_diff(new = "https://github.com/r-lib/sessioninfo/issues/6")
   [2] /Library/Frameworks/R.framework/Versions/4.1/Resources/library
 ```
 
+## Code of Conduct
+
+Please note that the sessioninfo project is released with a
+[Contributor Code of Conduct](https://r-lib.github.io/sessioninfo/CODE_OF_CONDUCT.html).
+By contributing to this project, you agree to abide by its terms.
+
 ## License
 
 GPL-2
diff --git a/debian/changelog b/debian/changelog
index 4f2fca0..285e2ec 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+r-cran-sessioninfo (1.2.2+git20220701.1.0d74fe9-1) UNRELEASED; urgency=low
+
+  * New upstream snapshot.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Thu, 19 Jan 2023 05:55:25 -0000
+
 r-cran-sessioninfo (1.2.2-1) unstable; urgency=medium
 
   * Team upload.
diff --git a/man/session_diff.Rd b/man/session_diff.Rd
index 0265aac..fc7519e 100644
--- a/man/session_diff.Rd
+++ b/man/session_diff.Rd
@@ -25,9 +25,12 @@ session, and uses its output.
 \item \code{"clipboard"} takes the session info from the system clipboard.
 If the clipboard contains a URL, it is followed to download the
 session info.
-\item A URL starting with \verb{http://} or \verb{https://}. \code{session_diff} searches
-the HTML (or text) page for the session info header to find the session
-info.
+\item The URL where you inspect the results for a GitHub Actions job.
+Typically has this form:\preformatted{https://github.com/OWNER/REPO/runs/JOB_ID?check_suite_focus=true
+}
+\item Any other URL starting with \verb{http://} or \verb{https://}. \code{session_diff()}
+searches the HTML (or text) page for the session info header to find the
+session info.
 }
 }
 \examples{
diff --git a/man/sessioninfo-package.Rd b/man/sessioninfo-package.Rd
new file mode 100644
index 0000000..b6a8d6e
--- /dev/null
+++ b/man/sessioninfo-package.Rd
@@ -0,0 +1,38 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/sessioninfo-package.R
+\docType{package}
+\name{sessioninfo-package}
+\alias{sessioninfo}
+\alias{sessioninfo-package}
+\title{sessioninfo: R Session Information}
+\description{
+Query and print information about the current R session. It is similar to 'utils::sessionInfo()', but includes more information about packages, and where they were installed from.
+}
+\seealso{
+Useful links:
+\itemize{
+  \item \url{https://github.com/r-lib/sessioninfo#readme}
+  \item \url{https://r-lib.github.io/sessioninfo/}
+  \item Report bugs at \url{https://github.com/r-lib/sessioninfo/issues}
+}
+
+}
+\author{
+\strong{Maintainer}: Gábor Csárdi \email{csardi.gabor@gmail.com}
+
+Authors:
+\itemize{
+  \item Hadley Wickham
+  \item Winston Chang
+  \item Robert Flight
+  \item Kirill Müller
+  \item Jim Hester
+}
+
+Other contributors:
+\itemize{
+  \item R Core team [contributor]
+}
+
+}
+\keyword{internal}

Debdiff

File lists identical (after any substitutions)

Control files: lines which differ (wdiff format)

  • Depends: r-base-core (>= 4.2.2.20221110-2), 4.2.0-1~jan+unchanged1), r-api-4.0, r-cran-cli (>= 3.1.0)
  • Suggests: r-cran-callr, r-cran-covr, r-cran-gh, r-cran-reticulate, r-cran-rmarkdown, r-cran-withr

More details

Full run details