Skip to content

📸 A GitHub Action to capture screenshots of a website, across Windows, Mac, and Linux

License

Notifications You must be signed in to change notification settings

swinton/screenshot-website

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

📸 screenshot-website

A GitHub Action to capture screenshots of a website, across Windows, Mac, and Linux

Contents

Usage

- name: Screenshot Website
  uses: swinton/screenshot-website@v1.x
  with:
    source: https://github.com/swinton/screenshot-website
    destination: screenshot.png

Inputs

Required inputs

  1. source: Source of the content to be captured, may be a URL or HTML string, e.g. https://example.com/
  2. destination: Destination filename the captured website will be written to, defaults to screenshot.png

Optional inputs

Most of the options listed here (inputType, width, height, etc.) can be passed as inputs, just pass in a kebab-cased equivalent, e.g. full-page for fullPage:

- name: Screenshot Website
  uses: swinton/screenshot-website@v1.x
  with:
    source: https://github.com/swinton/screenshot-website
    destination: screenshot.png
    full-page: true

Outputs

An artifact will be created automatically for each screenshot captured. The following additional outputs are also supported:

  1. path: The filesystem path to the captured screenshot

Advanced Usage

Use a matrix to capture screenshots across different operating systems, e.g.

jobs:
  screenshot:
    name: Screenshot
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.os }}

    steps:

    - name: Screenshot Website
      uses: swinton/screenshot-website@v1.x
      with:
        source: https://github.com/swinton/screenshot-website
        destination: screenshot-${{ matrix.os }}.png

Combine a matrix with additional options such as width, e.g.

jobs:
  screenshot:
    name: Screenshot
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        width: [1200, 992, 768, 600]
    runs-on: ${{ matrix.os }}

    steps:

    - name: Screenshot Website
      uses: swinton/screenshot-website@v1.x
      with:
        source: https://github.com/swinton/screenshot-website
        destination: screenshot-${{ matrix.os }}-${{ matrix.width }}.png
        width: ${{ matrix.width }}

Credits

About

📸 A GitHub Action to capture screenshots of a website, across Windows, Mac, and Linux

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •