diff --git a/.github/workflows/visit-page.yml b/.github/workflows/visit-page.yml index db82de5..a133016 100644 --- a/.github/workflows/visit-page.yml +++ b/.github/workflows/visit-page.yml @@ -1,12 +1,12 @@ -name: Visit Page Daily +name: Visit GitHub Page on: + workflow_dispatch: # Allows manual trigger from GitHub Actions UI schedule: - - cron: '0 0 * * *' # Runs once daily at midnight UTC - workflow_dispatch: # Allows manual triggering of the workflow + - cron: '0 * * * *' # Runs every hour; adjust as needed jobs: - visit_page_job: + visit-page: runs-on: ubuntu-latest steps: @@ -16,10 +16,14 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v2 with: - node-version: '16' # Ensure Node.js version is compatible + node-version: 'lts/*' # Installs the latest LTS version of Node.js - name: Install dependencies - run: npm install + run: npm install selenium-webdriver - - name: Run the visit script - run: node scripts/visit.js # Replace with the actual path if necessary + - name: Set up Chrome + uses: browser-actions/setup-chrome@v1 + + - name: Run Visit Script + run: | + node scripts/visit.js diff --git a/scripts/visit.js b/scripts/visit.js index e40ff66..03f19d6 100644 --- a/scripts/visit.js +++ b/scripts/visit.js @@ -1,30 +1,25 @@ const { Builder } = require('selenium-webdriver'); const chrome = require('selenium-webdriver/chrome'); -// URL to visit -const url = 'https://github.com/yashksaini-coder'; // Replace with your desired URL +const url = 'https://github.com/yashksaini-coder'; (async function visitPage() { - // Set up Chrome options for fast execution let options = new chrome.Options(); - options.addArguments('--headless'); // Run in headless mode + options.addArguments('--headless'); options.addArguments('--disable-infobars'); options.addArguments('--disable-extensions'); options.addArguments('--no-sandbox'); options.addArguments('--disable-gpu'); options.addArguments('--disable-dev-shm-usage'); - // Initialize WebDriver let driver = await new Builder().forBrowser('chrome').setChromeOptions(options).build(); try { - // Visit the URL 1000 times - for (let i = 0; i < 1000; i++) { + for (let i = 0; i < 500; i++) { // Reduced visits to avoid excessive requests console.log(`Visit ${i + 1} to ${url}`); await driver.get(url); } } finally { - // Close the browser after completion await driver.quit(); } })();