Skip to content

Commit 98c9e22

Browse files
Merge pull request #1 from space-coder-ai/main
✨ Major Update Co-authored-by: yashksaini-coder <[email protected]>
2 parents da35aa6 + ec85ef6 commit 98c9e22

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

.github/workflows/visit-page.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: Visit Page Daily
1+
name: Visit GitHub Page
22

33
on:
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

88
jobs:
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

scripts/visit.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,25 @@
11
const { Builder } = require('selenium-webdriver');
22
const 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
})();

0 commit comments

Comments
 (0)