By default, when Render.com creates a PR environment, it adds a comment to your PR. We use the Render API to add a deployment and update its state.
![Screenshot of Render comment and deployment](https://private-user-images.githubusercontent.com/2841780/247519233-5519f640-06dd-4a24-81f4-e25f5309cfe4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU4NDQxNTEsIm5iZiI6MTcyNTg0Mzg1MSwicGF0aCI6Ii8yODQxNzgwLzI0NzUxOTIzMy01NTE5ZjY0MC0wNmRkLTRhMjQtODFmNC1lMjVmNTMwOWNmZTQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkwOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MDlUMDEwNDExWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NTc3ZjU4YzY5ZWFjMWI3YTE4ZTNhNTkwOGRjNTRjZGE0YTE4YzU1OTExNTUyNjAwZDM3NDY5OGJiMWIwZjI1YyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.lMMm-DyGnzA1DVD5q94Yh-yA2RDGPpByp5pXLxgKyZM)
Note that this action waits until the deployment is completed, so you will be billed for the minutes where it's essentially waiting for the deployment to be completed or errored.
Add you Render API key to the Actions secret RENDER_API_KEY
and create a worklow .github/workflows/render-deployment-status.yml
:
name: Render deployment status
on:
issue_comment:
types: [created]
jobs:
update:
timeout-minutes: 15
runs-on: ubuntu-latest
if: github.event.comment.user.login == 'render[bot]'
permissions:
deployments: write
steps:
- uses: AnandChowdhary/render-deployment-status-action@main
with:
render-api-key: ${{ secrets.RENDER_API_KEY }}
github-token: ${{ secrets.GITHUB_TOKEN }}
This workflow uses the latest version of this action and runs whenever a comment is made by Render's app. The default GitHub token is used with "write" permission for "deployments".