Render #445
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
on: | |
schedule: | |
- cron: '0 0 * * *' | |
push: | |
branches: main | |
paths: | |
- data/theatres.csv | |
workflow_dispatch: | |
name: Render | |
jobs: | |
render: | |
runs-on: ubuntu-latest | |
env: | |
GH_TOKEN: ${{ secrets.github_token }} | |
BRANCH: ci/render-figures | |
COMMIT: "ci: automatic figure rendering" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Git Config | |
shell: bash | |
run: | | |
git config --local user.name github-actions[bot] | |
git config --local user.email 41898282+github-actions[bot]@users.noreply.github.com | |
- name: Checkout/Create branch | |
shell: bash | |
run: | | |
if git show-ref --quiet refs/heads/${{ env.BRANCH }}; then | |
echo "Branch ${{ env.BRANCH }} already exists." | |
git branch -D "${{ env.BRANCH }}" | |
git push origin --delete "${{ env.BRANCH }}" | |
fi | |
git checkout -b "${{ env.BRANCH }}" | |
- name: Install R | |
uses: r-lib/actions/setup-r@v2 | |
- name: Install R packages | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
packages: | | |
any::here | |
any::data.table | |
any::ggplot2 | |
any::ggtext | |
any::scales | |
any::lubridate | |
any::showtext | |
any::svglite | |
any::jsonlite | |
any::rvest | |
- name: Render figures | |
shell: bash | |
run: Rscript scripts/imdb-ratings.r | |
- name: Commit | |
shell: bash | |
run: | | |
git add media/* | |
git commit -m "${{ env.COMMIT }}" | |
- name: Push changes | |
shell: bash | |
run: | | |
git push --force origin ${{ env.BRANCH }} | |
- name: Create Pull Request | |
shell: bash | |
run: | | |
gh pr create --fill-first --base "main" --head "${{ env.BRANCH }}" --label "Type: CI/CD :robot:" | |
- name: Merge Pull Request | |
shell: bash | |
run: | | |
gh pr merge --auto --squash --delete-branch |