screenshot #750
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: screenshot | |
on: | |
schedule: | |
- cron: '0 11 * * *' | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Log level' | |
required: false | |
default: 'Manual testing' | |
tags: | |
description: 'Test scenario tags' | |
jobs: | |
print_dos_sites: | |
runs-on: macOS-latest | |
env: | |
GITHUB_PAT: ${{ secrets.PAT_GITHUB }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
- name: Use Node.js 14.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 14.x | |
- name: Install packages | |
run: | | |
install.packages(c("webshot2","purrr","dplyr")) | |
shell: Rscript {0} | |
- name: Remove old instances | |
run: |- | |
git config user.name "Automated" | |
git config user.email "[email protected]" | |
git rm -r screenshots | |
git commit -m "Remove data: `date +'%Y-%m-%d %H:%M:%S'`" || exit 0 | |
git push | |
- name: Restore screenshots directory | |
run: |- | |
git config user.name "Automated" | |
git config user.email "[email protected]" | |
mkdir screenshots | |
touch screenshots/.gitkeep | |
git add screenshots/.gitkeep | |
git commit -m "Restore directory: `date +'%Y-%m-%d %H:%M:%S'`" || exit 0 | |
git push | |
- name: Take screenshots and partial commit | |
id: retry | |
uses: nick-fields/retry@v2 | |
with: | |
timeout_minutes: 10 | |
max_attempts: 7 | |
retry_on: error | |
continue_on_error: true | |
command: Rscript screenshot_script.R | |
on_retry_command: | | |
git config user.name "Automated" | |
git config user.email "[email protected]" | |
git add screenshots/* | |
git commit -m "Latest partial data: `date +'%Y-%m-%d %H:%M:%S'`" || exit 0 | |
git push | |
- name: Commit final results | |
run: |- | |
git config user.name "Automated" | |
git config user.email "[email protected]" | |
git add screenshots/* | |
git commit -m "Latest data: `date +'%Y-%m-%d %H:%M:%S'`" || exit 0 | |
git push |