From 1ec72bbbb7f1bf8c6e6d14542aef0d5682543f47 Mon Sep 17 00:00:00 2001 From: Tom Pasierb Date: Wed, 11 Jun 2025 16:46:21 +0200 Subject: [PATCH] add support for specifying check's title that's different from its name fixes #24 --- README.md | 30 +++++++++++++++++++++++++++++- dist/index.js | 2 +- src/checks.ts | 1 + src/namespaces/Inputs.ts | 1 + 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 95ef2ae..ff526d0 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,7 @@ jobs: fail-on-error: true ``` -Finally, steps that have not been marked with a conclusion can be finalized to a specifed conclusion. This ensures there will be no checks defined upfront stuck in a non-final state when the job ends. +Finally, steps that have not been marked with a conclusion can be finalized to a specified conclusion. This ensures there will be no checks defined upfront stuck in a non-final state when the job ends. ```yml jobs: @@ -145,6 +145,34 @@ jobs: conclusion: cancelled ``` +### Additional check information + +When a check is created or updated additional information may be provided as supported by the GitHub Checks feature. + +```yml +jobs: + build: + steps: + - name: Report PHPUnit Conclusion + if: always() + uses: dflydev/check-runs-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + id: phpunit + conclusion: ${{ steps.phpunit.outcome }} + fail-on-error: true + output: | + { + "title": "title visible on both Conversation and Checks tabs", + "summary": "markdown supporting field shown on the Checks tab", + "text_description": "another markdown supporting field shown on the Checks tab" + } +``` + +Mapping of the properties provided in the `output` object to the Checks `output` is as follows: +- `title` is mapped from `title` if provided falling back to `name`, +- `summary` is mapped from `summary`, +- `text` is mapped from `text_description` ## Author diff --git a/dist/index.js b/dist/index.js index be0d064..df15e23 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2042,7 +2042,7 @@ const Inputs = __importStar(__webpack_require__(615)); const unpackInputs = (inputs) => { const output = inputs.output ? { - output: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (inputs.name ? { title: inputs.name } : {})), (inputs.output.summary ? { summary: inputs.output.summary } : {})), (inputs.output.text_description + output: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (inputs.name ? { title: inputs.name } : {})), (inputs.output.title ? { title: inputs.output.title } : {})), (inputs.output.summary ? { summary: inputs.output.summary } : {})), (inputs.output.text_description ? { text: inputs.output.text_description } : {})), (inputs.actions ? { actions: inputs.actions } : {})), (inputs.images ? { images: inputs.images } : {})), } diff --git a/src/checks.ts b/src/checks.ts index 8f76e1f..72bb122 100644 --- a/src/checks.ts +++ b/src/checks.ts @@ -11,6 +11,7 @@ const unpackInputs = (inputs: Inputs.CheckRun): object => { ? { output: { ...(inputs.name ? {title: inputs.name} : {}), + ...(inputs.output.title ? {title: inputs.output.title} : {}), ...(inputs.output.summary ? {summary: inputs.output.summary} : {}), ...(inputs.output.text_description ? {text: inputs.output.text_description} diff --git a/src/namespaces/Inputs.ts b/src/namespaces/Inputs.ts index 9952b4a..3560d7c 100644 --- a/src/namespaces/Inputs.ts +++ b/src/namespaces/Inputs.ts @@ -48,6 +48,7 @@ export type Images = Octokit.ChecksCreateParamsOutputImages[] export type Actions = Octokit.ChecksCreateParamsActions[] export interface Output { + title?: string summary: string text_description?: string }