{"id":14062869,"url":"https://github.com/ijlyttle/projthis-demo","last_synced_at":"2026-03-18T19:29:42.433Z","repository":{"id":37672333,"uuid":"307195286","full_name":"ijlyttle/projthis-demo","owner":"ijlyttle","description":"Demo of projthis","archived":false,"fork":false,"pushed_at":"2026-02-06T08:14:34.000Z","size":844,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-06T16:27:20.163Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ijlyttle.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-10-25T21:23:02.000Z","updated_at":"2026-02-06T08:14:39.000Z","dependencies_parsed_at":"2023-09-27T13:46:20.427Z","dependency_job_id":"5c062af7-50bb-4f66-9f6d-352a186ecddf","html_url":"https://github.com/ijlyttle/projthis-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ijlyttle/projthis-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ijlyttle%2Fprojthis-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ijlyttle%2Fprojthis-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ijlyttle%2Fprojthis-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ijlyttle%2Fprojthis-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ijlyttle","download_url":"https://codeload.github.com/ijlyttle/projthis-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ijlyttle%2Fprojthis-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29376884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T18:17:34.915Z","status":"ssl_error","status_checked_at":"2026-02-12T18:17:34.495Z","response_time":55,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-13T07:02:47.700Z","updated_at":"2026-02-12T18:32:39.807Z","avatar_url":"https://github.com/ijlyttle.png","language":null,"funding_links":[],"categories":["Others"],"sub_categories":[],"readme":"---\noutput: github_document\ntitle: \"projthis Demonstration\"\ndate: '`r lubridate::now(tz = \"UTC\")` UTC'\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n\u003c!-- badges: start --\u003e\n\u003c!-- badges: end --\u003e\n\nThe goal of this project is to show how you can use the [projthis]() package, along with [usethis](), to build a project workflow that manages package dependencies. \n\n## Demo\n\nThis demo is run automatically by GitHub Actions, every day at 02:30 UTC, as well as whenever there is a change to `README.Rmd`.\n\nFor this demo, we will select a letter at random, then get a data frame of the top ten most-downloaded packages (from the day's top 100) that contain this letter in its name. \n\n```{r setup, message=FALSE}\nlibrary(\"cranlogs\")\nlibrary(\"dplyr\")\nlibrary(\"stringr\")\nlibrary(\"conflicted\")\n\nconflict_prefer(\"filter\", \"dplyr\")\n```\n\n```{r letter}\nletter \u003c- sample(letters, 1)\nletter\n```\n\n```{r}\ncran_top_downloads(when = \"last-day\", count = 100) %\u003e%\n  filter(str_detect(package, regex(letter, ignore_case = TRUE))) %\u003e%\n  head(10)\n```\n\n## Steps\n\nThese are the steps I took to build this project and automate the GitHub Actions workflow.\n\n```r\nlibrary(\"projthis\")\nlibrary(\"usethis\")\n```\n\n### Initial structure\n\n1. `proj_create(\"../projthis-demo\")`\n1. `use_mit_license()`\n1. `use_git()`\n1. `use_github()`\n1. `use_readme_rmd()`\n1. edit `README.Rmd` and `DESCRIPTION` \n\n## Create demo\n\n1. Add **Demo** section to `README.Rmd`\n1. `proj_update_deps()` to add packages to `DESCRIPTION`\n\n## Add GitHub Action\n\nWe want to automate the build on a schedule. \n\n1. `proj_use_github_action()`\n1. Modify `.github/workflows/project-run.yaml` to customize trigger, what is built, and what is deployed.\n\nThis is a modification of the [pkgdown Actions file](https://github.com/r-lib/actions/blob/v2/examples/pkgdown.yaml), where the build is triggered by either:\n\n- a change to `README.Rmd`\n- the clock changing to 08:00 UTC\n\n```yaml\non:\n\n  # # runs whenever you push a specific branch\n  # push:\n  #   branches: [main, master]\n\n  # # runs on pull requests to a specific branch\n  # pull_request:\n  #   branches: [main, master]\n  \n  # runs when we push README.Rmd\n  push:\n    paths:\n      - README.Rmd\n\n  # runs on a schedule using UTC - see https://en.wikipedia.org/wiki/Cron\n  schedule:\n    - cron:  '00 02 * * *' # 08:00 UTC, every day\n```\n\nI also modified a bit at the end of the Actions file, to specify the rendering and deployment. In this case, we are rendering the `README.Rmd` file, committing `README.md` then pushing back to the original branch:\n\n```yaml\n      # rename and adapt this step to build your project\n      - name: Render\n        # if you are running only R commands, this can be a convenient syntax\n        run: |\n          rmarkdown::render(\"README.Rmd\")\n        shell: Rscript {0}\n\n      # rename and adapt this step to deploy your project\n      - name: Commit\n        # if you need to combine R commands with shell commands, try this syntax\n        #\n        # caution to stay away from syntax like `git add -A` as you might be committing\n        #  files that you would prefer not to commit:\n        #  https://twitter.com/JennyBryan/status/1319320033063923712\n        run: |\n          git config --local user.email \"actions@github.com\"\n          git config --local user.name \"GitHub Actions\"\n          git add \"README.md\"\n          git commit -m 'automated run' || echo \"No changes to commit\"\n          git push origin || echo \"No changes to commit\"\n```\n\nIt is likely your build and deploy processes will be more complicated, but this gives you a sense of how to get things working.\nIn Actions, as with any CI system, there is an element of \"try stuff until it works\", which can be frustrating.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fijlyttle%2Fprojthis-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fijlyttle%2Fprojthis-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fijlyttle%2Fprojthis-demo/lists"}