Skip to content

Commit d14b500

Browse files
authored
Merge pull request #25 from OpenRailAssociation/create-gh-deployments
Add option to create GitHub deployments
2 parents 3c22313 + a389e2a commit d14b500

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

.github/workflows/selftest.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,4 @@ jobs:
7171
linkchecker_exclude: "example.com,example.org"
7272
linkchecker_include_fragments: true
7373
linkchecker_verbose: true
74+
gh_deployment: "preview"

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ jobs:
110110
| `linkchecker_verbose` | <p>Turn on verbose linkchecker logging in action logs (true/false)</p> | `false` | `false` |
111111
| `sticky_comment_enabled` | <p>Whether to enable sticky comments for the pull request. Defaults to true.</p> | `false` | `true` |
112112
| `step_summary_enabled` | <p>Whether to enable step summaries in the GitHub Actions UI. Defaults to true.</p> | `false` | `true` |
113+
| `gh_deployment` | <p>Name of the optional GitHub deployment to create. Requires the deployments permission. Defaults to empty, in which case no deployment is created.</p> | `false` | `""` |
113114
<!-- action-docs-inputs source="action.yml" -->
114115

115116
<!-- action-docs-outputs source="action.yml" -->

action.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ inputs:
134134
required: false
135135
default: "true"
136136

137+
gh_deployment:
138+
description: "Name of the optional GitHub deployment to create. Requires the deployments permission. Defaults to empty, in which case no deployment is created."
139+
required: false
140+
default: ""
141+
137142
outputs:
138143
url:
139144
description: "The URL of the deployed production or preview website"
@@ -279,6 +284,16 @@ runs:
279284
:---:
280285
| <p><br />:x: Preview has been removed.<br /><br /></p>
281286
287+
- name: "Create GitHub deployment"
288+
if: inputs.gh_deployment != '' && env.IS_PREVIEW == 'true'
289+
uses: chrnorm/deployment-action@51e93982518dc06e500fe65559032a439663aaac # v2.0.7
290+
with:
291+
token: "${{ github.token }}"
292+
environment: "${{ inputs.gh_deployment }}"
293+
environment-url: "${{ env.URL }}"
294+
transient-environment: true
295+
initial-status: "success"
296+
282297
# ----------------------------------------------------------------------------------------------
283298
# LINK CHECKER
284299
# ----------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)