Writing GitHub Metrics to Googlesheet #79
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Writing GitHub Metrics to Googlesheet | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * 0' | |
jobs: | |
write-data: | |
name: Write Data | |
runs-on: ubuntu-latest | |
container: | |
image: cansav09/metricminer | |
steps: | |
- name: Authorize metricminer | |
env: | |
METRICMINER_GITHUB_PAT: ${{ secrets.METRICMINER_GITHUB_PAT }} | |
METRICMINER_GOOGLE_ACCESS: ${{ secrets.METRICMINER_GOOGLE_ACCESS }} | |
METRICMINER_GOOGLE_REFRESH: ${{ secrets.METRICMINER_GOOGLE_REFRESH }} | |
run: | | |
library(magrittr) | |
# Authorize GitHub | |
metricminer::auth_from_secret("github", token = Sys.getenv("METRICMINER_GITHUB_PAT")) | |
# Authorize Google | |
metricminer::auth_from_secret("google", | |
refresh_token = Sys.getenv("METRICMINER_GOOGLE_REFRESH"), | |
access_token = Sys.getenv("METRICMINER_GOOGLE_ACCESS"), | |
cache = TRUE | |
) | |
gsheet <- "https://docs.google.com/spreadsheets/d/1lk3vMgE4CNuACrI1mzHrv6AsvXbdhw1zJENMkIEhrZs/edit#gid=0" | |
repos <- c( | |
"fhdsl/metricminer", | |
"fhdsl/metricminer.org", | |
"jhudsl/ottrpal", | |
"jhudsl/ari", | |
"jhudsl/cow", | |
"jhudsl/ottrproject.org", | |
"jhudsl/ottr_docker", | |
"jhudsl/ottr-reports", | |
"fhdsl/conrad", | |
"jhudsl/text2speech", | |
"jhudsl/OTTR_Quizzes", | |
"jhudsl/OTTR_Template", | |
"jhudsl/OTTR_Template_Website", | |
"jhudsl/ITCR_Tables", | |
"jhudsl/ITN_Platforms", | |
"fhdsl/Choosing_Genomics_Tools", | |
"jhudsl/Informatics_Research_Leadership", | |
"jhudsl/Documentation_and_Usability", | |
"jhudsl/Reproducibility_in_Cancer_Informatics", | |
"jhudsl/Adv_Reproducibility_in_Cancer_Informatics", | |
"fhdsl/GitHub_Automation_for_Scientists", | |
"jhudsl/Computing_for_Cancer_Informatics", | |
"fhdsl/Overleaf_and_LaTeX_for_Scientific_Articles", | |
"fhdsl/Ethical_Data_Handling_for_Cancer_Research", | |
"fhdsl/AI_for_Decision_Makers", | |
"fhdsl/AI_for_Efficient_Programming", | |
"fhdsl/NIH_Data_Sharing" | |
) | |
repo_metrics <- metricminer::get_multiple_repos_metrics(repo_names = repos, time_course = TRUE) | |
combine_data <- googlesheets4::read_sheet(gsheet) %>% | |
dplyr::bind_rows(repo_metrics) %>% | |
dplyr::distinct() | |
datasheet <- metricminer::write_to_gsheet(gsheet = gsheet, | |
input = combine_data, | |
overwrite = TRUE) | |
shell: Rscript {0} |