Skip to content

Commit 751b37c

Browse files
pquentingithub-actions[bot]
authored andcommitted
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 bbd5dcf)
1 parent bc18fc0 commit 751b37c

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

.github/validate-pr/index.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,18 @@ async function run() {
149149
}
150150
changedApis.sort((a, b) => a.api.localeCompare(b.api))
151151

152+
let comment = `Following you can find the validation changes against the target branch for the API${changedApis.length === 1 ? '' : 's'}.\n\n`
152153
if (changedApis.length > 0) {
153-
let comment = `Following you can find the validation changes for the API${changedApis.length === 1 ? '' : 's'} you have modified.\n\n`
154154
comment += '| API | Status | Request | Response |\n'
155155
comment += '| --- | --- | --- | --- |\n'
156156
for (const change of changedApis) {
157157
comment += buildDiffTableLine(change)
158158
}
159-
comment += `\nYou can validate ${changedApis.length === 1 ? 'this' : 'these'} API${changedApis.length === 1 ? '' : 's'} yourself by using the ${tick}make validate${tick} target.\n`
160-
161-
core.setOutput('has_results', 'true')
162-
core.setOutput('comment_body', comment)
163159
} else {
164-
core.setOutput('has_results', 'false')
160+
comment += '**No changes detected**.\n'
165161
}
162+
comment += `\nYou can validate ${changedApis.length === 1 ? 'this' : 'these'} API${changedApis.length === 1 ? '' : 's'} yourself by using the ${tick}make validate${tick} target.\n`
163+
core.setOutput('comment_body', comment)
166164

167165
core.info('Done!')
168166
}
@@ -236,4 +234,4 @@ function generateResponse (r) {
236234
run().catch((err) => {
237235
core.error(err)
238236
process.exit(1)
239-
})
237+
})

.github/workflows/validate-pr.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ jobs:
7575
body-includes: 'Following you can find the validation changes'
7676

7777
- name: Create or update comment
78-
if: steps.validation.outputs.has_results == 'true'
7978
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
8079
with:
8180
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)