Refresh Google Forms #27
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
name: Refresh Data | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * 0' | |
push: | |
branches: [ main ] | |
path: _config_automation.yml | |
jobs: | |
yaml-check: | |
name: Load user automation choices | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- 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_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 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 --cran_packages ${{needs.yaml-check.outputs.cran_packages}} | |
- 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 data/cran/* | |
git commit -m 'Refresh CRAN' || 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 --ga_property_ids ${{needs.yaml-check.outputs.ga_property_ids}} | |
- 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 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 --gh_repos ${{needs.yaml-check.outputs.gh_repos}} | |
- 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 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 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 --drive_id ${{needs.yaml-check.outputs.drive_id}} | |
- 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 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 --video_ids ${{needs.yaml-check.outputs.video_ids}} | |
- 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 data/youtube/* | |
git commit -m 'Refresh Youtube' || echo "No changes to commit" | |
git push origin main || echo "No changes to push" |