Capture Screenshot #7
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: Capture Screenshot | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Daily at midnight | |
workflow_dispatch: | |
jobs: | |
capture: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 # Update to the latest version | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 # Update to the latest version | |
with: | |
node-version: '20' # Ensure Node.js 20 is used | |
- name: Install Dependencies | |
run: | | |
npm install puppeteer | |
- name: Capture Screenshot | |
run: | | |
node capture-screenshot.js | |
env: | |
WEBSITE_URL: 'http://www.keays.xyz' | |
- name: Upload Screenshot | |
uses: actions/upload-artifact@v3 | |
with: | |
name: screenshot | |
path: media/screenshot.png | |
- name: Set up Git | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "berlintay" | |
- name: Commit and Push Screenshot | |
run: | | |
git add media/screenshot.png | |
git commit -m "Update screenshot" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKE }} |