Skip to content

Commit 880668c

Browse files
committed
add environment_url output variable
1 parent 67f9fd6 commit 880668c

File tree

6 files changed

+15
-10
lines changed

6 files changed

+15
-10
lines changed

README.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,11 @@ jobs:
7272

7373
## Action outputs
7474

75-
| name | description |
76-
| ---------------- | ------------------------------------------------------ |
77-
| `deployment_id` | The ID of the deployment as returned by the GitHub API |
78-
| `deployment_url` | The URL of the created deployment |
75+
| name | description |
76+
| ----------------- | ---------------------------------------------------------------------- |
77+
| `deployment_id` | The ID of the deployment as returned by the GitHub API |
78+
| `deployment_url` | The URL of the created deployment |
79+
| `environment_url` | The environment URL of the deployment (the same as the input variable) |
7980

8081
## Notes
8182

@@ -118,18 +119,18 @@ jobs:
118119
uses: chrnorm/deployment-status@v2
119120
with:
120121
token: '${{ github.token }}'
121-
environment-url: http://my-app-url.com
122-
state: 'success'
122+
environment-url: ${{ steps.deployment.outputs.environment_url }}
123123
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
124+
state: 'success'
124125

125126
- name: Update deployment status (failure)
126127
if: failure()
127128
uses: chrnorm/deployment-status@v2
128129
with:
129130
token: '${{ github.token }}'
130-
environment-url: http://my-app-url.com
131-
state: 'failure'
131+
environment-url: ${{ steps.deployment.outputs.environment_url }}
132132
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
133+
state: 'failure'
133134
```
134135
135136
## Breaking changes

action.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ outputs:
7070
description: 'The ID of the created deployment'
7171
deployment_url:
7272
description: 'The URL of the created deployment'
73-
73+
environment_url:
74+
description: 'The environment URL of the deployment'
7475
runs:
7576
using: 'node16'
7677
main: 'dist/index.js'

dist/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ function run() {
104104
yield octokit.rest.repos.createDeploymentStatus(Object.assign(Object.assign({}, context.repo), { deployment_id: deployment.data.id, description, state: initialStatus, log_url: logUrl, environment_url: environmentUrl, auto_inactive: autoInactive }));
105105
core.setOutput('deployment_id', deployment.data.id.toString());
106106
core.setOutput('deployment_url', deployment.data.url);
107+
core.setOutput('environment_url', environmentUrl);
107108
}
108109
catch (error) {
109110
core.error(error);

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/main.js

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ function run() {
9797
yield octokit.rest.repos.createDeploymentStatus(Object.assign(Object.assign({}, context.repo), { deployment_id: deployment.data.id, description, state: initialStatus, log_url: logUrl, environment_url: environmentUrl, auto_inactive: autoInactive }));
9898
core.setOutput('deployment_id', deployment.data.id.toString());
9999
core.setOutput('deployment_url', deployment.data.url);
100+
core.setOutput('environment_url', environmentUrl);
100101
}
101102
catch (error) {
102103
core.error(error);

src/main.ts

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ async function run(): Promise<void> {
106106

107107
core.setOutput('deployment_id', deployment.data.id.toString())
108108
core.setOutput('deployment_url', deployment.data.url)
109+
core.setOutput('environment_url', environmentUrl)
109110
} catch (error: any) {
110111
core.error(error)
111112
core.setFailed(`Error creating GitHub deployment: ${error.message}`)

0 commit comments

Comments
 (0)