Skip to content

Github Action to schedule a new Screenshot Job with Websiteshot.

License

Notifications You must be signed in to change notification settings

websiteshot/github-action

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

Websiteshot Github Action


Never spend time again to create awesome screenshots of your websites.


This Github action creates a new screenshot job via Websiteshot. Prerequisite for the use is an account at Websiteshot.

Usage

Name of Action: websiteshot/github-action

Mandatory Environment Variables:

  • PROJECT_ID: The associated Websiteshot project in which the screenshots are created.
  • API_KEY: Your Websiteshot API Key

One of those Environment Variables must be set:

  • URLS: URLs für Screenshot creation in JSON Format (Array of url-config)
  • TEMPLATE_ID: Template Id of Template that should be used

Optional Parameters:

  • SCHEDULE_TS: Timestamp when to trigger the Screenshot Job
  • SCHEDULE_UNIT and SCHEDULE_VALUE: Instead of a timestamp you can specify a relative description from now on, like 15m that will be translated into a timestamp in 15 minutes.

This Github action uses Websiteshot's NodeJS client to trigger screenshot jobs.

Example

An example configuration looks like this:

name: Publish

on: [push]

jobs:
  create-screenshot:
    runs-on: ubuntu-latest
    name: 'Schedule Screenshot Creation'
    steps:
      - uses: websiteshot/github-action@main
        env:
          PROJECT_ID: ${{ secrets.PROJECT_ID }}
          API_KEY: ${{ secrets.API_KEY }}
          URLS: '[{"url": "https://websiteshot.app", "name": "Websiteshot"}]'
          SCHEDULE_UNIT: 'm'
          SCHEDULE_VALUE: '5'

Or if you want to execute a Job via Template:

name: Publish

on: [push]

jobs:
  create-screenshot:
    runs-on: ubuntu-latest
    name: 'Schedule Screenshot Creation via Template'
    steps:
      - uses: websiteshot/github-action@main
        env:
          PROJECT_ID: ${{ secrets.PROJECT_ID }}
          API_KEY: ${{ secrets.API_KEY }}
          TEMPLATE_ID: 'abcdef-ghi...'