Skip to content

Commit 17d89c3

Browse files
Fix action.yaml with missing input variable (#46)
* Fix action.yaml with missing input variable This commit fixes the action.yaml with the missing input variable to surpress the warning we were seeing when running the action * Add ability to specify the deployment sha If this workflow isn't being ran from the current branch (which is the case when you have a workflow being triggered by chatops), we need to be able to specify the current commit this workflow should report.
1 parent 1830167 commit 17d89c3

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ inputs:
4141
deployment_confidence_url:
4242
required: false
4343
description: link for the deployment confidence dashboard
44+
mutate_deployment:
45+
required: false
46+
description: Whether the deployment status needs to be mutated by this action
47+
current_sha:
48+
required: false
49+
description: Sha of the deployment
4450
runs:
4551
using: 'node12'
4652
main: 'dist/main/index.js'

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "action-deploy",
3-
"version": "2.2.0",
3+
"version": "2.3.0",
44
"private": true,
55
"description": "Action to manage GitHub deployments",
66
"main": "lib/main.js",

src/post.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export async function post (): Promise<void> {
1313
let slackChannel: string
1414
let deploymentConfidenceUrl: string
1515
let mutateDeployment: boolean
16+
let currentSha: string
1617

1718
const { actor, ref, repo, sha } = github.context
1819

@@ -48,6 +49,9 @@ export async function post (): Promise<void> {
4849
mutateDeployment = getInput('mutate_deployment') !== 'false'
4950
console.log(`mutate_deployment: ${mutateDeployment.toString()}`)
5051

52+
currentSha = getInput('current_sha') ?? sha
53+
console.log(`current_sha: ${currentSha}`)
54+
5155
deploymentConfidenceUrl = getInput('deployment_confidence_url') ?? ''
5256
console.log(`deployment confidence dashboard URL: ${deploymentConfidenceUrl}`)
5357
} catch (error) {
@@ -72,7 +76,7 @@ export async function post (): Promise<void> {
7276
}
7377

7478
// Post Slack notification
75-
await postSlackNotification(slackToken, slackChannel, environment, status, github.context, deploymentConfidenceUrl)
79+
await postSlackNotification(slackToken, slackChannel, environment, status, github.context, deploymentConfidenceUrl, currentSha)
7680

7781
try {
7882
// If the deployment was managed by another workflow we don't want to mutate it here

src/utils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ export async function postSlackNotification (
4848
environment: string,
4949
status: DeploymentStatus,
5050
context: Context,
51-
deploymentConfidenceUrl: string): Promise<void> {
51+
deploymentConfidenceUrl: string,
52+
sha: string): Promise<void> {
5253
if (slackToken === '' || slackChannel === '') {
5354
return
5455
}
55-
const { actor, repo, sha, payload } = context
56+
const { actor, repo, payload } = context
5657

5758
try {
5859
const statusIcon = status === 'success' ? '✅' : '❌'

0 commit comments

Comments
 (0)