From cd35019a731c074b91aa1a6e0cc23b83929eeef2 Mon Sep 17 00:00:00 2001 From: Felippe Rodrigo Puhle Date: Mon, 11 Jan 2021 10:58:20 -0300 Subject: [PATCH] allow setting deployments environment --- README.md | 4 ++++ index.js | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d8204fea..e5c5550a 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,10 @@ Please note that this action is supposed to be run on the `pull_request` event. The github secret `${{ secrets.GITHUB_TOKEN }}` +### `environment` + +Optional — The name of the environment that was deployed to (e.g., staging or production) + ### `max_timeout` Optional — The amount of time to spend waiting on Vercel. Defaults to `60` seconds diff --git a/index.js b/index.js index 4c98616b..b6895a50 100644 --- a/index.js +++ b/index.js @@ -55,6 +55,7 @@ const run = async () => { // Inputs const GITHUB_TOKEN = core.getInput('token', { required: true }) + const ENVIRONMENT = core.getInput('environment') const MAX_TIMEOUT = Number(core.getInput("max_timeout")) || 60; // Fail if we have don't have a github token @@ -91,7 +92,8 @@ const run = async () => { const deployments = await octokit.repos.listDeployments({ owner, repo, - sha: prSHA + sha: prSHA, + environment: ENVIRONMENT }) const deployment = deployments.data.length > 0 && deployments.data[0];