https://github.com/jexniemi/browserless-action-runner
Run Puppeteer or Playwright web scraper (or other browser tasks) easily in headless mode as a GitHub Action
https://github.com/jexniemi/browserless-action-runner
actions browser browserless chromium headless marketplace-action playwright puppeteer scraper scraping web
Last synced: 4 months ago
JSON representation
Run Puppeteer or Playwright web scraper (or other browser tasks) easily in headless mode as a GitHub Action
- Host: GitHub
- URL: https://github.com/jexniemi/browserless-action-runner
- Owner: jexniemi
- License: mit
- Created: 2024-08-23T13:04:32.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-24T11:30:06.000Z (almost 2 years ago)
- Last Synced: 2025-10-31T01:44:33.374Z (8 months ago)
- Topics: actions, browser, browserless, chromium, headless, marketplace-action, playwright, puppeteer, scraper, scraping, web
- Language: TypeScript
- Homepage: https://github.com/marketplace/actions/browserless-action-runner
- Size: 35.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# Browserless Action Runner
This GitHub Action allows you to easily run Puppeteer or Playwright web scraper in headless mode using the [Browserless](https://github.com/browserless/browserless) Docker image. Alternatively, you can use this Action to run any other process that requires headless browser.
## Usage
### Web Scraping
In order to use this action with Puppeteer or Playwright, you need to set up the browser's web socket endpoint:
Puppeteer:
```js
const browser = await puppeteer.connect({
browserWSEndpoint: 'ws://localhost:3000',
});
````
Playwright:
```js
const browser = await pw.firefox.connect(
'ws://localhost:3000/firefox/playwright',
);
```
### Creating a workflow
To use this action, you need to set up a workflow file (e.g., `.github/workflows/main.yml`) in your repository. Here's an example of how to use this action:
```yml
name: Scrape web
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
- name: Install dependencies
run: cd example && npm install
- name: Compile TypeScript
run: cd example && npx tsc
- name: Run Puppeteer Action
uses: jexniemi/browserless-action-runner@v0.1
with:
start_commands: |
node example/build/index.js
```
In this example, the start_commands input is a multiline string, with each command on a separate line. These commands are run after the Browserless Docker container is up and running.
## Contributing
If you have suggestions for how browserless-action-runner could be improved, or want to report a bug, open an issue!