Skip to content

Refresh Data

Refresh Data #63

Workflow file for this run

name: Refresh Data
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0'
push:
branches: [ main ]
paths: '_config_automation.yml'
jobs:
yaml-check:
name: Load user automation choices
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.METRICMINER_GITHUB_PAT }}
- name: Load environment from YAML
uses: doughepi/[email protected]
with:
files: _config_automation.yml # Pass a space-separated list of configuration files. Rightmost files take precedence.
outputs:
toggle_calendly: "${{ env.REFRESH_CALENDLY }}"
toggle_cran: "${{ env.REFRESH_CRAN }}"
toggle_citations: "${{ env.REFRESH_CITATIONS }}"
toggle_ga: "${{ env.REFRESH_GA }}"
toggle_github: "${{ env.REFRESH_GITHUB }}"
toggle_googleforms: "${{ env.REFRESH_GOOGLEFORMS }}"
toggle_slido: "${{ env.REFRESH_SLIDO }}"
toggle_youtube: "${{ env.REFRESH_YOUTUBE }}"
rendering_docker_image: "${{ env.RENDERING_DOCKER_IMAGE }}"
### Inputs ###
cran_packages: "${{ env.CRAN_PACKAGES }}"
gh_repos: "${{ env.GH_REPOS }}"
ga_property_ids: "${{ env.GA_PROPERTY_IDS }}"
google_forms: "${{ env.GOOGLE_FORMS }}"
drive_id: "${{ env.DRIVE_ID }}"
video_ids: "${{ env.VIDEO_IDS }}"
refresh-calendly:
name: Refresh Calendly
needs: yaml-check
runs-on: ubuntu-latest
container:
image: ${{needs.yaml-check.outputs.rendering_docker_image}}
if: ${{needs.yaml-check.outputs.toggle_calendly == 'yes'}}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.METRICMINER_GITHUB_PAT }}
- name: Refresh Calendly
env:
METRICMINER_CALENDLY: ${{ secrets.METRICMINER_CALENDLY }}
METRICMINER_GOOGLE_ACCESS: ${{ secrets.METRICMINER_GOOGLE_ACCESS }}
METRICMINER_GOOGLE_REFRESH: ${{ secrets.METRICMINER_GOOGLE_REFRESH }}
run: |
Rscript refresh-scripts/refresh-calendly.R
- name: Commit calendly data
run: |
git config --system --add safe.directory $GITHUB_WORKSPACE
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git fetch
git pull --set-upstream origin main --allow-unrelated-histories --strategy-option=ours
git add --force metricminer_data/calendly/*
git commit -m 'Refresh Calendly' || echo "No changes to commit"
git push origin main || echo "No changes to push"
refresh-cran:
name: Refresh CRAN
needs: yaml-check
runs-on: ubuntu-latest
container:
image: ${{needs.yaml-check.outputs.rendering_docker_image}}
if: ${{needs.yaml-check.outputs.toggle_cran == 'yes'}}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.METRICMINER_GITHUB_PAT }}
- name: Refresh CRAN
run: |
echo ${{needs.yaml-check.outputs.cran_packages}}
Rscript refresh-scripts/refresh-cran.R
- name: Commit CRAN data
run: |
git config --system --add safe.directory $GITHUB_WORKSPACE
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git fetch
git pull --set-upstream origin main --allow-unrelated-histories --strategy-option=ours
git add --force metricminer_data/cran/*
git commit -m 'Refresh CRAN' || echo "No changes to commit"
git push origin main || echo "No changes to push"
refresh-citations:
name: Refresh Citations
needs: yaml-check
runs-on: ubuntu-latest
container:
image: ${{needs.yaml-check.outputs.rendering_docker_image}}
if: ${{needs.yaml-check.outputs.toggle_citations == 'yes'}}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.METRICMINER_GITHUB_PAT }}
fetch-depth: 0
- name: Refresh citations
run: |
echo ${{needs.yaml-check.outputs.citation_papers}}
Rscript refresh-scripts/refresh-citations.R
- name: Commit citation data
run: |
git config --system --add safe.directory $GITHUB_WORKSPACE
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git fetch
git pull --set-upstream origin main --allow-unrelated-histories --strategy-option=ours
git add --force metricminer_data/citations/*
git commit -m 'Refresh citations' || echo "No changes to commit"
git push origin main || echo "No changes to push"
refresh-ga:
name: Refresh Google Analytics
needs: yaml-check
runs-on: ubuntu-latest
container:
image: ${{needs.yaml-check.outputs.rendering_docker_image}}
if: ${{needs.yaml-check.outputs.toggle_ga == 'yes'}}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.METRICMINER_GITHUB_PAT }}
- name: Refresh Google Analytics
env:
METRICMINER_GOOGLE_ACCESS: ${{ secrets.METRICMINER_GOOGLE_ACCESS }}
METRICMINER_GOOGLE_REFRESH: ${{ secrets.METRICMINER_GOOGLE_REFRESH }}
run: |
echo ${{needs.yaml-check.outputs.ga_property_ids}}
Rscript refresh-scripts/refresh-ga.R
- name: Commit GA data
run: |
git config --system --add safe.directory $GITHUB_WORKSPACE
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git fetch
git pull --set-upstream origin main --allow-unrelated-histories --strategy-option=ours
git add --force metricminer_data/ga/*
git commit -m 'Refresh GA' || echo "No changes to commit"
git push origin main || echo "No changes to push"
refresh-github:
name: Refresh Github
needs: yaml-check
runs-on: ubuntu-latest
container:
image: ${{needs.yaml-check.outputs.rendering_docker_image}}
if: ${{needs.yaml-check.outputs.toggle_github == 'yes'}}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.METRICMINER_GITHUB_PAT }}
- name: Refresh Github
env:
METRICMINER_GITHUB_PAT: ${{ secrets.METRICMINER_GITHUB_PAT }}
run: Rscript refresh-scripts/refresh-github.R
- name: Commit Github data
run: |
git config --system --add safe.directory $GITHUB_WORKSPACE
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git fetch
git pull --set-upstream origin main --allow-unrelated-histories --strategy-option=ours
git add --force metricminer_data/github/*
git commit -m 'Refresh GitHub' || echo "No changes to commit"
git push origin main || echo "No changes to push"
refresh-googleforms:
name: Refresh Google Forms
needs: yaml-check
runs-on: ubuntu-latest
container:
image: ${{needs.yaml-check.outputs.rendering_docker_image}}
if: ${{needs.yaml-check.outputs.toggle_googleforms == 'yes'}}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.METRICMINER_GITHUB_PAT }}
- name: Refresh Google Forms
env:
METRICMINER_GOOGLE_ACCESS: ${{ secrets.METRICMINER_GOOGLE_ACCESS }}
METRICMINER_GOOGLE_REFRESH: ${{ secrets.METRICMINER_GOOGLE_REFRESH }}
run: Rscript refresh-scripts/refresh-googleforms.R --google_forms ${{needs.yaml-check.outputs.google_forms}}
- name: Commit Google Forms data
run: |
git config --system --add safe.directory $GITHUB_WORKSPACE
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git fetch
git pull --set-upstream origin main --allow-unrelated-histories --strategy-option=ours
git add --force metricminer_data/googleforms/*
git commit -m 'Refresh Google Forms' || echo "No changes to commit"
git push origin main || echo "No changes to push"
refresh-slido:
name: Refresh Slido
needs: yaml-check
runs-on: ubuntu-latest
container:
image: ${{needs.yaml-check.outputs.rendering_docker_image}}
if: ${{needs.yaml-check.outputs.toggle_slido == 'yes'}}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.METRICMINER_GITHUB_PAT }}
- name: Refresh Slido
env:
METRICMINER_GOOGLE_ACCESS: ${{ secrets.METRICMINER_GOOGLE_ACCESS }}
METRICMINER_GOOGLE_REFRESH: ${{ secrets.METRICMINER_GOOGLE_REFRESH }}
run: Rscript refresh-scripts/refresh-slido.R
- name: Commit Google Forms data
run: |
git config --system --add safe.directory $GITHUB_WORKSPACE
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git fetch
git pull --set-upstream origin main --allow-unrelated-histories --strategy-option=ours
git add --force metricminer_data/googleforms/*
git commit -m 'Refresh Google Forms' || echo "No changes to commit"
git push origin main || echo "No changes to push"
refresh-youtube:
name: Refresh Youtube
needs: yaml-check
runs-on: ubuntu-latest
container:
image: ${{needs.yaml-check.outputs.rendering_docker_image}}
if: ${{needs.yaml-check.outputs.toggle_youtube == 'yes'}}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.METRICMINER_GITHUB_PAT }}
- name: Refresh Youtube
env:
METRICMINER_GOOGLE_ACCESS: ${{ secrets.METRICMINER_GOOGLE_ACCESS }}
METRICMINER_GOOGLE_REFRESH: ${{ secrets.METRICMINER_GOOGLE_REFRESH }}
run: Rscript refresh-scripts/refresh-youtube.R
- name: Commit Youtube data
run: |
git config --system --add safe.directory $GITHUB_WORKSPACE
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git fetch
git pull --set-upstream origin main --allow-unrelated-histories --strategy-option=ours
git add --force metricminer_data/youtube/*
git commit -m 'Refresh Youtube' || echo "No changes to commit"
git push origin main || echo "No changes to push"