Skip to content

Commit 9129d7d

Browse files
author
Federico Builes
committed
don't set output on every run
1 parent a1be843 commit 9129d7d

File tree

6 files changed

+18
-25
lines changed

6 files changed

+18
-25
lines changed

dist/index.js

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

dist/index.js.map

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

package-lock.json

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

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dependency-review-action",
3-
"version": "4.1.2",
3+
"version": "4.1.3",
44
"private": true,
55
"description": "A GitHub Action for Dependency Review",
66
"main": "lib/main.js",

src/comment-pr.ts

+1-13
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import * as core from '@actions/core'
33
import * as githubUtils from '@actions/github/lib/utils'
44
import * as retry from '@octokit/plugin-retry'
55
import {RequestError} from '@octokit/request-error'
6-
import {ConfigurationOptions} from './schemas'
76

87
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry)
98
const octo = new retryingOctokit(
@@ -13,22 +12,11 @@ const octo = new retryingOctokit(
1312
// Comment Marker to identify an existing comment to update, so we don't spam the PR with comments
1413
const COMMENT_MARKER = '<!-- dependency-review-pr-comment-marker -->'
1514

16-
export async function commentPr(
17-
summary: typeof core.summary,
18-
config: ConfigurationOptions
19-
): Promise<void> {
15+
export async function commentPr(summary: typeof core.summary): Promise<void> {
2016
const commentContent = summary.stringify()
2117

2218
core.setOutput('comment-content', commentContent)
2319

24-
if (
25-
config.comment_summary_in_pr !== 'always' &&
26-
config.comment_summary_in_pr === 'on-failure' &&
27-
process.exitCode !== core.ExitCode.Failure
28-
) {
29-
return
30-
}
31-
3220
if (!github.context.payload.pull_request) {
3321
core.warning(
3422
'Not in the context of a pull request. Skipping comment creation.'

src/main.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,13 @@ async function run(): Promise<void> {
144144

145145
summary.addScannedDependencies(changes)
146146
printScannedDependencies(changes)
147-
await commentPr(core.summary, config)
147+
if (
148+
config.comment_summary_in_pr === 'always' ||
149+
(config.comment_summary_in_pr === 'on-failure' &&
150+
process.exitCode === core.ExitCode.Failure)
151+
) {
152+
await commentPr(core.summary)
153+
}
148154
} catch (error) {
149155
if (error instanceof RequestError && error.status === 404) {
150156
core.setFailed(

0 commit comments

Comments
 (0)