File tree Expand file tree Collapse file tree 2 files changed +15
-16
lines changed Expand file tree Collapse file tree 2 files changed +15
-16
lines changed Original file line number Diff line number Diff line change 1- name : Visit Page Daily
1+ name : Visit GitHub Page
22
33on :
4+ workflow_dispatch : # Allows manual trigger from GitHub Actions UI
45 schedule :
5- - cron : ' 0 0 * * *' # Runs once daily at midnight UTC
6- workflow_dispatch : # Allows manual triggering of the workflow
6+ - cron : ' 0 * * * *' # Runs every hour; adjust as needed
77
88jobs :
9- visit_page_job :
9+ visit-page :
1010 runs-on : ubuntu-latest
1111
1212 steps :
@@ -16,10 +16,14 @@ jobs:
1616 - name : Set up Node.js
1717 uses : actions/setup-node@v2
1818 with :
19- node-version : ' 16 ' # Ensure Node.js version is compatible
19+ node-version : ' lts/* ' # Installs the latest LTS version of Node.js
2020
2121 - name : Install dependencies
22- run : npm install
22+ run : npm install selenium-webdriver
2323
24- - name : Run the visit script
25- run : node scripts/visit.js # Replace with the actual path if necessary
24+ - name : Set up Chrome
25+ uses : browser-actions/setup-chrome@v1
26+
27+ - name : Run Visit Script
28+ run : |
29+ node scripts/visit.js
Original file line number Diff line number Diff line change 11const { Builder } = require ( 'selenium-webdriver' ) ;
22const chrome = require ( 'selenium-webdriver/chrome' ) ;
33
4- // URL to visit
5- const url = 'https://github.com/yashksaini-coder' ; // Replace with your desired URL
4+ const url = 'https://github.com/yashksaini-coder' ;
65
76( async function visitPage ( ) {
8- // Set up Chrome options for fast execution
97 let options = new chrome . Options ( ) ;
10- options . addArguments ( '--headless' ) ; // Run in headless mode
8+ options . addArguments ( '--headless' ) ;
119 options . addArguments ( '--disable-infobars' ) ;
1210 options . addArguments ( '--disable-extensions' ) ;
1311 options . addArguments ( '--no-sandbox' ) ;
1412 options . addArguments ( '--disable-gpu' ) ;
1513 options . addArguments ( '--disable-dev-shm-usage' ) ;
1614
17- // Initialize WebDriver
1815 let driver = await new Builder ( ) . forBrowser ( 'chrome' ) . setChromeOptions ( options ) . build ( ) ;
1916
2017 try {
21- // Visit the URL 1000 times
22- for ( let i = 0 ; i < 1000 ; i ++ ) {
18+ for ( let i = 0 ; i < 500 ; i ++ ) { // Reduced visits to avoid excessive requests
2319 console . log ( `Visit ${ i + 1 } to ${ url } ` ) ;
2420 await driver . get ( url ) ;
2521 }
2622 } finally {
27- // Close the browser after completion
2823 await driver . quit ( ) ;
2924 }
3025} ) ( ) ;
You can’t perform that action at this time.
0 commit comments