Keepalive #215
This file contains hidden or 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: Keepalive | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| jobs: | |
| visit-website: | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| - name: Install Playwright and dependencies | |
| run: | | |
| npm init -y | |
| npm install @playwright/test | |
| npx playwright install chromium | |
| npx playwright install-deps | |
| - name: Create test script | |
| run: | | |
| cat > visit-site.js << 'EOL' | |
| const { chromium } = require('@playwright/test'); | |
| (async () => { | |
| console.log('Starting browser...'); | |
| const browser = await chromium.launch({ | |
| headless: true | |
| }); | |
| const context = await browser.newContext(); | |
| const page = await context.newPage(); | |
| try { | |
| await page.goto('https://laclipasa.fly.dev/ui', { | |
| waitUntil: 'networkidle', | |
| timeout: 60000 | |
| }); | |
| await page.screenshot({ path: 'screenshot.png' }); | |
| } catch (error) { | |
| console.error('Error occurred:', error); | |
| process.exit(1); | |
| } finally { | |
| await browser.close(); | |
| } | |
| })(); | |
| EOL | |
| - name: Run test | |
| run: node visit-site.js | |
| - name: Upload screenshot as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: site-screenshot | |
| path: screenshot.png | |
| retention-days: 7 |