generated from gadenbuie/status
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
91 lines (80 loc) · 2.32 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
title: "GitHub Dashboard"
output: github_document
params:
set_main_width: false
# provide user name to include all public, non-fork repos from the owner
all_by_owner: theislab
# the repository where this repo exists
status_repo: gadenbuie/status
# list of repositories by owner name and repo (appear before owner's repos)
repos:
theislab:
- scib
---
![](https://github.com/`r rmarkdown::metadata$status_repo`/workflows/Render%20Status/badge.svg)
`r strftime(Sys.time(), "%F %T %Z")`
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE)
library(purrr)
library(dplyr)
library(glue)
```
```{r gh-get-repos}
if (!exists("gh_get_repo_status")) {
source("gh-repo-info.R")
}
metadata <-
if (interactive()) {
rmarkdown::yaml_front_matter("README.Rmd")
} else {
rmarkdown::metadata
}
repo_list <- metadata$repos
owner <- metadata$all_by_owner
if (!is.character(owner) && length(owner) == 1) {
warning("`all_by_owner` should be a single GitHub user account")
owner <- NULL
}
repos <- gh_get_repo_status(repo_list, all_by_owner = owner)
has_repos_without_actions <- any(is.na(repos$badge))
```
```{r repo-status}
repos %>%
select_if(negate(is.list)) %>%
# repos with Github Actions have badges
filter(!is.na(badge)) %>%
mutate(
commit_message = map_chr(commit_message, ~ strsplit(.x, "\n")[[1]][1]),
commit_id_6 = substr(commit_id, 1, 6)
) %>%
arrange(desc(stargazers_count)) %>%
transmute(
Repo = glue("[{full_name}]({html_url_repo})"),
Stars = stargazers_count,
Subscribers = subscribers_count,
Issues = open_issues_count,
Forks = forks_count,
Status = ifelse(!is.na(badge), badge, ""),
Commit = glue('<a href="{html_url_repo}/commit/{commit_id}" title="{commit_message}">{commit_id_6}</a>')
) %>%
knitr::kable(escape = FALSE)
```
```{r eval=has_repos_without_actions, results="asis"}
cat("## Repos without Github Actions")
repos %>%
select_if(negate(is.list)) %>%
filter(is.na(badge)) %>%
arrange(desc(stargazers_count)) %>%
transmute(
Repo = glue("[{full_name}]({html_url_repo})"),
Stars = stargazers_count,
Subscribers = subscribers_count,
Issues = open_issues_count,
Forks = forks_count
) %>%
knitr::kable(escape = FALSE)
```
```{css eval=isTRUE(params$set_main_width)}
main { max-width: 54em; }
```