Git Product home page Git Product logo

wait-for-netlify-action's Introduction

Wait for Netlify Deployment

Do you have other Github actions (Lighthouse, Cypress, etc) that depend on the Netlify deploy URL? This action will wait until the deploy URL is available before running the next task.

This action uses the Netlify API to always retrieve the correct deployment being built. You will need to generate a Personal Access Token to use and pass it as the NETLIFY_TOKEN environment variable.

Env

NETLIFY_TOKEN

Required. Your Netlify Personal Access Token to use for API access. This should be set as a GitHub secret, see example.

Inputs

site_id

Required The API ID of your site. See Settings > Site Details > General in the Netlify UI

max_timeout

Optional โ€” The amount of time to spend waiting on the Netlify deployment to respond with a success HTTP code after reaching "ready" status. Defaults to 60 seconds.

context

Optional โ€” The Netlify deploy context. Can be branch-deploy, production or deploy-preview. Defaults to all of them.

Outputs

url

The Netlify deploy preview url that was deployed.

deploy_id

The Netlify deployment ID that was deployed.

Example usage

Basic Usage

steps:
  - name: Wait for Netlify Deploy
    uses: progging/[email protected]
    id: waitForDeployment
    with:
      site_id: 'YOUR_SITE_ID' # See Settings > Site Details > General in the Netlify UI
    env:
      NETLIFY_TOKEN: ${{ secrets.NETLIFY_TOKEN }}

# Then use it in a later step like:
# ${{ steps.waitForDeployment.outputs.url }}
Complete example with Cypress
name: Cypress
on: pull_request
jobs:
  integration:
    runs-on: ubuntu-latest

    jobs:
    cypress:
      runs-on: ubuntu-latest
      steps:
        - uses: actions/checkout@v2

        - name: Install modules
          run: npm ci

        - name: Wait for Netlify
          uses: probablyup/[email protected]
          id: waitForDeployment
          with:
            site_id: '[your site ID here]'
          env:
            NETLIFY_TOKEN: ${{ secrets.NETLIFY_TOKEN }}

        - name: Run Cypress
          uses: cypress-io/github-action@v2
          with:
            record: true
            config: baseUrl=${{ steps.waitForDeployment.outputs.url }}
          env:
            # pass the Dashboard record key as an environment variable
            CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
            # this is automatically set by GitHub
            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Complete example with Lighthouse
name: Lighthouse

on: pull_request

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1
      - name: Use Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 16
      - name: Install
        run: |
          npm ci
      - name: Build
        run: |
          npm run build
      - name: Waiting for 200 from Netlify
        uses: probablyup/[email protected]
        id: waitForNetlifyDeploy
        with:
          site_id: 'YOUR_SITE_ID' # See Settings > Site Details > General in the Netlify UI
        env:
          NETLIFY_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
      - name: Lighthouse CI
        run: |
          npm install -g @lhci/[email protected]
          lhci autorun --upload.target=temporary-public-storage --collect.url=${{ steps.waitForNetlifyDeploy.outputs.url }} || echo "LHCI failed!"
        env:
          LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
This is a heavily-modified fork of [kamranayub/wait-for-netlify-action](https://github.com/kamranayub/wait-for-netlify-action).

wait-for-netlify-action's People

Contributors

jakepartusch avatar josephduffy avatar kamranayub avatar kevinpainchaud avatar progging avatar quantizor avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.