Skip to content

simonireilly/observatory-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

Observatory GitHub Action

Run the Mozilla Observatory in CI/CD for any website.

GitHub comment showing output from observatory report

About

This action is a light wrapper around mozilla/observatory-cli that returns a markdown string.

It can be used in conjunction with other comment based actions to add PR comments.

Detailed Examples

The github workflows folder contain detailed examples

Static URL on Pull Requests

# examples/workflows/static-url.yml

name: "branch"
on:
  pull_request:

jobs:
  static-url:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Test Observatory
        uses: simonireilly/observatory-github-action@v0.1.3
        id: observatory
        with:
          web_host: https://hungry-borg-990e06.netlify.app

      - name: Create commit comment
        uses: peter-evans/commit-comment@v1
        with:
          body: "# Branch PR ${{ steps.observatory.outputs.observatory-report }}"

GitHub comment showing output from observatory report

Deployment Status for Preview Environments

This method will work for Preview deploys that use the GitHub deployments API. It supports https://vercel.com/ preview Urls.

# examples/workflows/deployment_status.yml

name: "deployment-status"
on:
  deployment_status:

jobs:
  deployment_status:
    runs-on: ubuntu-latest
    if: github.event.deployment_status.state == 'success'
    steps:
      - uses: actions/checkout@v3

      - name: Test Observatory
        uses: simonireilly/observatory-github-action@v0.1.3
        id: observatory

      - name: Create commit comment
        uses: peter-evans/commit-comment@v1
        with:
          body: "# Deployment Status _${{ github.event.deployment_status.state }}_ ${{ steps.observatory.outputs.observatory-report }}"

GitHub comment showing output from observatory report

Contributing

Fork the repository and create a MR against the upstream.

Releasing

To release, with master branch checked out run:

yarn pub:beta

If this is to be a latest release run:

yarn pub:latest

Keep the changelog up to date between merge releases with:

## [Unchanged]

Powered By