@@ -139,15 +139,6 @@ export class Action {
139
139
return token ;
140
140
}
141
141
142
- get prComment ( ) : string {
143
- return `
144
- [${ this . commitSha } ](https://github.com/${ context . repo . owner } /${ context . repo . repo } /commit/${ this . commitSha } ) has been deployed!
145
- - **Commit:** \`${ this . commitSha } \`
146
- - **Stage:** \`${ this . stage } \`
147
- - **URL:** [${ this . httpApiUrl } ](${ this . httpApiUrl } )
148
- ` ;
149
- }
150
-
151
142
get commitSha ( ) : string {
152
143
if ( context . eventName === 'pull_request' ) {
153
144
return `${ context . payload . pull_request ?. head . sha } ` . substring ( 0 , 7 ) ;
@@ -165,17 +156,29 @@ export class Action {
165
156
async addPrComments ( ) : Promise < void > {
166
157
const destroy = boolean ( getState ( 'destroy' ) ) ;
167
158
if ( destroy ) {
159
+ debug ( 'Destroying, not adding PR comment.' ) ;
168
160
return ;
169
161
}
170
162
171
163
const { prNumber } = this ;
172
164
if ( ! prNumber ) {
165
+ debug ( 'No PR number found, can not add PR comment.' ) ;
166
+ return ;
167
+ }
168
+
169
+ const httpApiUrl = ( await this . httpApiUrl ) || 'Unknown' ;
170
+ if ( ! httpApiUrl ) {
171
+ debug ( "No HTTP API URL found, can't add PR comment." ) ;
173
172
return ;
174
173
}
175
174
176
175
const octokit = getOctokit ( this . token ) ;
177
176
await octokit . rest . issues . createComment ( {
178
- body : this . prComment ,
177
+ body : `
178
+ \`${ this . commitSha } \` has been deployed!
179
+ - **Stage:** \`${ this . stage } \`
180
+ - **URL:** [${ httpApiUrl } ](${ httpApiUrl } )
181
+ ` ,
179
182
owner : context . repo . owner ,
180
183
repo : context . repo . repo ,
181
184
issue_number : prNumber ,
0 commit comments