Capture Screenshot #1220
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: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: ' 0 */3 * * *' # Runs every hour (optional) | |
jobs: | |
capture: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install Dependencies | |
run: | | |
npm install puppeteer | |
- name: Capture Screenshot | |
run: | | |
node capture-screenshot.js | |
env: | |
WEBSITE_URL: 'https://keays.pro' | |
- name: Upload Screenshot | |
uses: actions/upload-artifact@v4 | |
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" | |
git config --global url."https://github.com/".insteadOf [email protected]: | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKE }} | |
- name: Commit and Push Screenshot | |
run: | | |
git add . | |
git commit -m "Update screenshot" || echo "No changes to commit" | |
git push origin master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKE }} |