From 95e8793083cb8ec374c37022a0938a9693b6af90 Mon Sep 17 00:00:00 2001 From: Jonathan Carroll Date: Sat, 21 Oct 2023 12:22:03 +1030 Subject: [PATCH] prototype GH action to collect RSS feed posts - to be extended (#1479) --- .github/workflows/actions.yml | 42 +++++++++++++++++++++++++++++++++++ scripts/curatinator.R | 7 ++++++ 2 files changed, 49 insertions(+) create mode 100644 .github/workflows/actions.yml create mode 100644 scripts/curatinator.R diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml new file mode 100644 index 000000000..9cd5cb0c0 --- /dev/null +++ b/.github/workflows/actions.yml @@ -0,0 +1,42 @@ +name: curatinator + +on: + workflow_dispatch: + inputs: + logLevel: + description: 'Log level' + required: true + default: 'warning' + tags: + description: 'Manual trigger' + schedule: + - cron: '0 9 * * 6' # At 09:00 on Saturday UTC + +jobs: + import-data: + runs-on: ubuntu-latest + steps: + - name: Set up R + uses: r-lib/actions/setup-r@v2 + + - name: Install packages + uses: r-lib/actions/setup-r-dependencies@v2 + with: + packages: | + any::tidyverse + any::tidyRSS + any::urltools + + - name: Check out repository + uses: actions/checkout@v3 + + - name: Collect content + run: Rscript -e 'source("scripts/curatinator.R")' + + - name: Commit results + run: | + git config --local user.email "actions@github.com" + git config --local user.name "GitHub Actions" + git add curatinator_latest.md + git commit -m 'Auto-collected data updated' || echo "No changes to commit" + git push origin || echo "No changes to commit" \ No newline at end of file diff --git a/scripts/curatinator.R b/scripts/curatinator.R new file mode 100644 index 000000000..30d868999 --- /dev/null +++ b/scripts/curatinator.R @@ -0,0 +1,7 @@ +source("scripts/get_rss.R") +f <- read.csv("rss_feeds.csv") +f <- f[f$ENABLE == 1, , drop = FALSE] +x <- get_rss_posts(f$URL) + +cat(x, file = "curatinator_latest.md") +