Skip to content

Commit

Permalink
Merge pull request #2 from marcelocarlos/add-output-src-file
Browse files Browse the repository at this point in the history
Add `output_source_file` input variable
  • Loading branch information
marcelocarlos authored Aug 21, 2023
2 parents 88b8a30 + 4a8cbd3 commit 48ec7ac
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ inputs:
output_text:
description: Details (body) of the check run with a maximum of 65535 characters (markdown supported)
required: false
output_source_file:
description: Path to a file containing the output to be used instead of using `output_text`). Only used if `output_text` is not set.
required: false
default: ''
output_annotations:
description: Information from your analysis to specific lines of code. Input must be in a JSON list format.
required: false
Expand Down
9 changes: 7 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12698,11 +12698,14 @@ function parseJson(string, reviver, filename) {
}
}

// EXTERNAL MODULE: external "fs"
var external_fs_ = __nccwpck_require__(7147);
;// CONCATENATED MODULE: ./main.js





async function run() {
try {
var context = github.context
Expand All @@ -12716,7 +12719,9 @@ async function run() {
var conclusion = core.getInput("conclusion")
var outputTitle = core.getInput("output_title")
var outputSummary = core.getInput("output_summary")
var outputText = core.getInput("output_text")

var outputText = core.getInput("output_text") != "" ? core.getInput("output_text") : external_fs_.readFileSync(core.getInput("output_source_file"), 'utf8')

var outputAnnotations = core.getInput("output_annotations")
if (outputAnnotations != "") {
outputAnnotations = parseJson(core.getInput("output_annotations"))
Expand All @@ -12743,7 +12748,7 @@ async function run() {
output: {
title: outputTitle,
summary: outputSummary,
text: outputText,
text: outText,
annotations: outputAnnotations,
images: outputImages
},
Expand Down
9 changes: 6 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as core from '@actions/core'
import * as github from '@actions/github'
import parseJson from 'parse-json';
import parseJson from 'parse-json'
import * as fs from 'fs'

async function run() {
try {
Expand All @@ -15,7 +16,9 @@ async function run() {
var conclusion = core.getInput("conclusion")
var outputTitle = core.getInput("output_title")
var outputSummary = core.getInput("output_summary")
var outputText = core.getInput("output_text")

var outputText = core.getInput("output_text") != "" ? core.getInput("output_text") : fs.readFileSync(core.getInput("output_source_file"), 'utf8')

var outputAnnotations = core.getInput("output_annotations")
if (outputAnnotations != "") {
outputAnnotations = parseJson(core.getInput("output_annotations"))
Expand All @@ -42,7 +45,7 @@ async function run() {
output: {
title: outputTitle,
summary: outputSummary,
text: outputText,
text: outText,
annotations: outputAnnotations,
images: outputImages
},
Expand Down

0 comments on commit 48ec7ac

Please sign in to comment.