Skip to content

GitHub Actions

Integrate Spectra.fm into your GitHub Actions workflow to automatically generate screenshots on releases, PRs, or any other trigger.

Add this workflow to .github/workflows/screenshots.yml:

name: Generate Screenshots
on:
release:
types: [published]
jobs:
export:
runs-on: ubuntu-latest
steps:
- name: Export screenshots
run: |
curl -X POST "https://api.spectra.fm/project/${{ vars.SPECTRA_PROJECT_ID }}/export" \
-H "X-API-Key: ${{ secrets.SPECTRA_API_KEY }}" \
-H "Content-Type: application/json" \
-d '{"combinations": [{"locale": "en", "theme": "light"}]}'

Add these to your repository settings under Settings > Secrets and variables > Actions:

SecretDescription
SPECTRA_API_KEYYour Spectra.fm API key

Add these under Settings > Secrets and variables > Actions > Variables:

VariableDescription
SPECTRA_PROJECT_IDYour Spectra.fm project ID
name: Preview Screenshots
on:
pull_request:
types: [opened, synchronize]
jobs:
preview:
runs-on: ubuntu-latest
steps:
- name: Generate preview
id: export
run: |
RESPONSE=$(curl -s -X POST "https://api.spectra.fm/project/${{ vars.SPECTRA_PROJECT_ID }}/export" \
-H "X-API-Key: ${{ secrets.SPECTRA_API_KEY }}" \
-H "Content-Type: application/json" \
-d '{"combinations": [{"locale": "en", "theme": "light"}]}')
echo "response=$RESPONSE" >> $GITHUB_OUTPUT
- name: Comment PR
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '📸 Screenshots generated! Check the Spectra.fm dashboard for previews.'
})
- name: Export all locales
run: |
curl -X POST "https://api.spectra.fm/project/${{ vars.SPECTRA_PROJECT_ID }}/export" \
-H "X-API-Key: ${{ secrets.SPECTRA_API_KEY }}" \
-H "Content-Type: application/json" \
-d '{
"combinations": [
{"locale": "en", "theme": "light"},
{"locale": "en", "theme": "dark"},
{"locale": "de", "theme": "light"},
{"locale": "de", "theme": "dark"},
{"locale": "ja", "theme": "light"},
{"locale": "ja", "theme": "dark"}
]
}'