Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/simonireilly/observatory-github-action

Run https://observatory.mozilla.org/ against pull requests and preview URLs
https://github.com/simonireilly/observatory-github-action

Last synced: 3 months ago
JSON representation

Run https://observatory.mozilla.org/ against pull requests and preview URLs

Awesome Lists containing this project

README

        

# Observatory GitHub Action

Run the [Mozilla Observatory](https://observatory.mozilla.org/) in CI/CD for any website.

![GitHub comment showing output from observatory report](.readme/example.png)

- [Observatory GitHub Action](#observatory-github-action)
- [About](#about)
- [Detailed Examples](#detailed-examples)
- [Static URL on Pull Requests](#static-url-on-pull-requests)
- [Deployment Status for Preview Environments](#deployment-status-for-preview-environments)
- [Contributing](#contributing)
- [Releasing](#releasing)
- [Powered By](#powered-by)

## About

This action is a light wrapper around [mozilla/observatory-cli](https://github.com/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

```yaml
# 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/[email protected]
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](.readme/static-url.png)

### Deployment Status for Preview Environments

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

```yaml
# 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/[email protected]
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](.readme/deployment-status.png)

## Contributing

Fork the repository and create a MR against the upstream.

### Releasing

To release, with master branch checked out run:

```bash
yarn pub:beta
```

If this is to be a latest release run:

```bash
yarn pub:latest
```

Keep the changelog up to date between merge releases with:

```markdown
## [Unchanged]
```

## Powered By

- [HTTP Observatory](https://github.com/mozilla/http-observatory) by April King
- [HTTP Observatory CLI](https://github.com/mozilla/observatory-cli) by April King