# netlify-plugin-github-actions

> Trigger a GitHub Actions workflow when a Netlify build succeeds.

Latest version **2.0.0** (published 2024-03-31) · 0 weekly downloads

## Install

```sh
npm install netlify-plugin-github-actions
pnpm add netlify-plugin-github-actions
yarn add netlify-plugin-github-actions
bun add netlify-plugin-github-actions
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2024-03-31 |
| First published | 2022-02-23 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | heymp |

## Links

- npm: https://www.npmjs.com/package/netlify-plugin-github-actions
- npm.io page: https://npm.io/package/netlify-plugin-github-actions

## Dependencies (1)

- [@octokit/core](https://npm.io/package/@octokit/core.md) ^6.0.1

## Recent versions

- 2.0.0 (latest) — 2024-03-31
- 1.0.0-rc.1 (rc) — 2023-02-01
- 0.0.2-next.0 (next) — 2022-08-23
- 1.0.0 — 2023-03-02
- 0.0.1 — 2022-02-23

## README

# Netlify Plugin GitHub Actions Webhook

Trigger a GitHub Actions workflow when a Netlify build succeeds.

## Inputs

| name       | description                                                                                                |
| ---------- | ---------------------------------------------------------------------------------------------------------- |
| owner      | Github repository owner (scope). e.g. for `https://github.com/actions/netlify`, the `owner` is `"actions"` |
| repository | Github repository name. e.g. for `https://github.com/actions/netlify`, the `repository` is `"netlify"`     |
| workflowId | Name of the workflow file e.g. `"visual-regression.yml"` or the workflow id number e.g. `42`               |

## Example `netlify.toml`

```toml
[[plugins]]
  package = "/tools/netlify-plugin-github-actions"

  [plugins.inputs]
    owner = "patternfly"
    repository = "patternfly-elements"
    workflowId = "visual-regression.yml"
```

## Outputs

The body of the webhook contains the following inputs.
Use them in your github workflow by reading from `${{ github.event.inputs.deployPrimeUrl }}`, for example.

| input               | description                                                                                                                                                                                                                             |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| branch              | The git branch the netlify build ran on                                                                                                                                                                                                 |
| head                | Name of the head branch netlify received from a Git provider.                                                                                                                                                                           |
| issueNumber         | The PR number for the deploy preview, if applicable                                                                                                                                                                                     |
| netlifyBuildContext | Name of the netlify build’s deploy context. It can be `production`, `deploy-preview` or `branch-deploy`.                                                                                                                                |
| netlifyBuildId      | Unique ID for the netlify build; for example: `5d4aeac2ccabf517d2f219b8`.                                                                                                                                                               |
| url                 | This URL represents the main address to your site. It can be either a Netlify subdomain or your own custom domain if you set one; for example, <https://petsof.netlify.app> or <https://www.petsofnetlify.com>.                         |
| deployUrl           | This URL represents the unique URL for an individual deploy. It starts with a unique ID that identifies the deploy; for example, <https://5b243e66dd6a547b4fee73ae--petsof.netlify.app>.                                                |
| deployPrimeUrl      | This URL represents the primary URL for an individual deploy, or a group of them, like branch deploys and Deploy Previews; for example, <https://feature-branch--petsof.netlify.app> or <https://deploy-preview-1--petsof.netlify.app>. |

## Example Workflow

```yml
name: Visual Regression Tests
on:
  workflow_dispatch:
    inputs:
      deployPrimeUrl:
        description: Origin to test, e.g. https://deploy-preview-1804--patternfly-elements.netlify.app/
        required: true

jobs:
  e2e:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 18
          cache: npm
      - run: npm ci --prefer-offline
      - name: Visual Regression Tests
        run: npx playwright test
        env:
          VISUAL_REGRESSION_ORIGIN: ${{ github.event.inputs.deployPrimeUrl }}

  lighthouse:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Lighthouse CI Action
        uses: treosh/lighthouse-ci-action@v8
        with:
          configPath: .lighthouserc.yml
          uploadArtifacts: true # save results as an action artifacts
          urls:
            ${{ github.event.inputs.deployPrimeUrl }}
            ${{ github.event.inputs.deployPrimeUrl }}/core/styles/demo/
```

---
_Source: https://npm.io/package/netlify-plugin-github-actions · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
