Skip to content

Trigger update

Trigger update #493

# Update the content on a daily basis
on:
push:
paths:
- .github/workflows/update_content.yaml
- docs/compute_1.md
# Do not do docs/compute_2.md: that one is generated by this script
- docs/courses_1.md
# Do not do docs/courses_2.md: that one is generated by this script
- docs/index_1.md
# Do not do docs/index_2.md: that one is generated by this script
- docs/other_1.md
# Do not do docs/other_2.md: that one is generated by this script
- docs/storage_1.md
# Do not do docs/storage_2.md: that one is generated by this script
- docs/web_host_1.md
# Do not do docs/web_host_2.md: that one is generated by this script
- scripts/create_compute_page.sh
- scripts/create_courses_page.sh
- scripts/create_index_page.sh
- scripts/create_other_page.sh
- scripts/create_storage_page.sh
- scripts/create_web_host_page.sh
- scripts/mark_computer_generated_file.R
- scripts/mark_computer_generated_files.sh
schedule:
- cron: "0 0 * * *" # Run daily
name: Update content
jobs:
update_content:
runs-on: ubuntu-latest
permissions:
contents: write
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
- name: Install libcurl4-openssl-dev
run: sudo apt install -qq libcurl4-openssl-dev
- name: Install libharfbuzz-dev libfribidi-dev
run: sudo apt install -qq libharfbuzz-dev libfribidi-dev
- name: Install libuv1-dev
run: sudo apt install -qq libuv1-dev
- name: Install dependencies
run: |
install.packages(c("remotes", "rcmdcheck"))
remotes::install_cran("dplyr")
remotes::install_cran("httr2")
remotes::install_cran("knitr")
remotes::install_cran("lubridate")
remotes::install_cran("readr")
remotes::install_cran("stringr")
remotes::install_cran("testthat")
remotes::install_cran("tibble")
remotes::install_cran("tidyr")
remotes::install_github("richelbilderbeek/scoreto")
shell: Rscript {0}
##########################
# Compute
##########################
- name: Create docs/compute_2.md
run: Rscript -e 'cat(scoreto::get_compute_as_markdown(), sep = "\n")' > docs/compute_2.md
- name: View compute_2.md
run: cat docs/compute_2.md
- name: Create docs/compute.md
run: ./scripts/create_compute_page.sh
- name: View docs/compute.md
run: cat docs/compute.md
##########################
# Courses
##########################
# Need cat to remove numbering
- name: Create docs/courses_2.md
run: Rscript -e 'cat(scoreto::get_courses_as_markdown(), sep = "\n")' > docs/courses_2.md
- name: View courses_2.md
run: cat docs/courses_2.md
- name: Create docs/courses.md and marks it as computer generated
run: ./scripts/create_courses_page.sh
- name: View docs/courses.md
run: cat docs/courses.md
- name: Create docs/courses.csv
run: Rscript -e 'scoreto::save_courses_as_csv("docs/courses.csv")'
- name: View docs/courses.csv
run: cat docs/courses.csv
##########################
# Index, i.e. logo's
##########################
# Need cat to remove numbering
- name: Create docs/index_2.md
run: Rscript -e 'cat(scoreto::get_all_provider_logos_as_markdown(), sep = "\n")' > docs/index_2.md
- name: View index_2.md
run: cat docs/index_2.md
- name: Create docs/index.md and marks it as computer generated
run: ./scripts/create_index_page.sh
- name: View docs/index.md
run: cat docs/index.md
##########################
# Other
##########################
- name: Create docs/other_2.md
run: Rscript -e 'cat(scoreto::get_other_as_markdown(), sep = "\n")' > docs/other_2.md
- name: View other_2.md
run: cat docs/other_2.md
- name: Create docs/other.md and marks it as computer generated
run: ./scripts/create_other_page.sh
- name: View docs/other.md
run: cat docs/other.md
##########################
# Storage
##########################
- name: Create docs/storage_2.md
run: Rscript -e 'cat(scoreto::get_storage_as_markdown(), sep = "\n")' > docs/storage_2.md
- name: View storage_2.md
run: cat docs/storage_2.md
- name: Create docs/storage.md and marks it as computer generated
run: ./scripts/create_storage_page.sh
- name: View docs/storage.md
run: cat docs/storage.md
##########################
# Web host
##########################
- name: Create docs/web_host_2.md
run: Rscript -e 'cat(scoreto::get_web_host_as_markdown(), sep = "\n")' > docs/web_host_2.md
- name: View web_host_2.md
run: cat docs/web_host_2.md
- name: Create docs/web_host.md and marks it as computer generated
run: ./scripts/create_web_host_page.sh
- name: View docs/web_host.md
run: cat docs/web_host.md
##########################
# Check content
##########################
- name: Check
run: ./scripts/check_no_numbering_in_md.sh
##########################
# Done with generating content
##########################
- name: View changes, if any
run: git status
- name: If no changes, we are done
run: |
# From https://stackoverflow.com/a/25149786/3364162
if [[ $(git status --porcelain) ]]; then
echo "Changes have been made"
else
echo "No changes have been made. Done!"
fi
# Cannot get this to work here, maybe for the better
#
# git pull --no-edit --rebase=true
#
- name: Add and commit changes, if any
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "Update content" || true
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}