Skip to content

Github Javascript Action to check and wait on the successful deployment of a Preview Environment from Render

Notifications You must be signed in to change notification settings

pascalvaccaro/check-render-preview

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Check Render Preview Environment Github Action

This action checks the deployment of preview environments featured by Render

Inputs

SERVICE_NAME

Required The name of the Render service to check

BRANCH_NAME

The name of the branch deployed by your Render Blueprint (defaults to master)

Outputs

env_url

The first service deployment URL

env_status

  • "success" if all your services are up
  • none otherwise

This action fails if one service deployment has a failed state

Step ID

You need to define an id for this action to be able to read its outputs later.

jobs:
  your_job:
    steps:
      - uses: actions/check-render-preview@v1
        id: wait # <= this is mandatory if you wish to read outputs later in the workflow

Environment

GITHUB_TOKEN

Required A valid Github Token with permissions to read this repository's deployments and deployments' statuses

You can find information about how to create a personal access token (PAT) here

Usage

# As a global env variable (if you need it elsewhere in your workflow)
env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# As a local env variable (the recommended way)
jobs:
  your_job:
    steps:
      - uses: actions/check-render-preview@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Example usage

You can use this action outputs in another step or in another job that needs it.

jobs:
  your_job:
    steps:
      # Define outputs if you wish to read them in another job
      outputs:
        env_status: ${{ steps.wait.outputs.env_status }}
        env_url: ${{ steps.wait.outputs.env_url }}  
    - uses: actions/check-render-preview@v1
      id: wait
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        SERVICE_NAME: dashboard
    - name: 'Check the Dashboard homepage'
      # Condition this step to the output of the previous step
      if: steps.wait.outputs.env_status == 'success'
      uses: lakuapik/gh-actions-http-status@v1
        with:
          sites: '["${{ steps.wait.outputs.env_url }}"]'
          expected: '[200]'
  your_other_job:
    needs: your_job
    # Run this job only if the deployment of your preview environments is successful
    if: needs.your_job.outputs.env_status == 'success'

About

Github Javascript Action to check and wait on the successful deployment of a Preview Environment from Render

Resources

Stars

Watchers

Forks

Packages

No packages published