From 6d138578f44dafe0e0471a3bf7c6ac7c93fd131d Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Mon, 7 Jul 2025 16:56:40 +0400 Subject: [PATCH] Output validation comments even without changes (#4781) * Output validation comments even without changes Otherwise, a PR that breaks validation but then restores it will keep a comment saying that validation is broken. * Adjust output * Try fixing branch name * Stop trying to display the target branch (cherry picked from commit bbd5dcf5faa025686e452ce20e87a4e9b5bd6a68) --- .github/validate-pr/index.js | 12 +++++------- .github/workflows/validate-pr.yml | 1 - 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/validate-pr/index.js b/.github/validate-pr/index.js index 1c7c336daf..331d5bc8a5 100644 --- a/.github/validate-pr/index.js +++ b/.github/validate-pr/index.js @@ -144,20 +144,18 @@ async function run() { } changedApis.sort((a, b) => a.api.localeCompare(b.api)) + let comment = `Following you can find the validation changes against the target branch for the API${changedApis.length === 1 ? '' : 's'}.\n\n` if (changedApis.length > 0) { - let comment = `Following you can find the validation changes for the API${changedApis.length === 1 ? '' : 's'} you have modified.\n\n` comment += '| API | Status | Request | Response |\n' comment += '| --- | --- | --- | --- |\n' for (const change of changedApis) { comment += buildDiffTableLine(change) } - comment += `\nYou can validate ${changedApis.length === 1 ? 'this' : 'these'} API${changedApis.length === 1 ? '' : 's'} yourself by using the ${tick}make validate${tick} target.\n` - - core.setOutput('has_results', 'true') - core.setOutput('comment_body', comment) } else { - core.setOutput('has_results', 'false') + comment += '**No changes detected**.\n' } + comment += `\nYou can validate ${changedApis.length === 1 ? 'this' : 'these'} API${changedApis.length === 1 ? '' : 's'} yourself by using the ${tick}make validate${tick} target.\n` + core.setOutput('comment_body', comment) core.info('Done!') } @@ -231,4 +229,4 @@ function generateResponse (r) { run().catch((err) => { core.error(err) process.exit(1) -}) \ No newline at end of file +}) diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index c5b02753d7..2e1222b7ac 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -78,7 +78,6 @@ jobs: body-includes: 'Following you can find the validation changes' - name: Create or update comment - if: steps.validation.outputs.has_results == 'true' uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 with: token: ${{ secrets.GITHUB_TOKEN }}