зеркало из https://github.com/microsoft/git.git
ci: make the whitespace checker more robust
In 32c83afc2c
(ci: github action - add check for whitespace errors,
2020-09-22), we introduced a GitHub workflow that automatically checks
Pull Requests for whitespace problems.
However, when affected lines contain one or more double quote
characters, this workflow failed to attach the informative comment
because the Javascript snippet incorrectly interpreted these quotes
instead of using the `git log` output as-is.
Let's fix that.
While at it, let's `await` the result of the `createComment()` function.
Finally, we enclose the log in the comment with ```...``` to avoid
having the diff marker be misinterpreted as an enumeration bullet.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
32c83afc2c
Коммит
cba2504d3d
|
@ -58,12 +58,14 @@ jobs:
|
|||
- name: Add Check Output as Comment
|
||||
uses: actions/github-script@v3
|
||||
id: add-comment
|
||||
env:
|
||||
log: ${{ steps.check_out.outputs.checkout }}
|
||||
with:
|
||||
script: |
|
||||
github.issues.createComment({
|
||||
await github.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: "Whitespace errors found in workflow ${{ github.workflow }}:\n\n${{ steps.check_out.outputs.checkout }}"
|
||||
body: `Whitespace errors found in workflow ${{ github.workflow }}:\n\n\`\`\`\n${process.env.log.replace(/\\n/g, "\n")}\n\`\`\``
|
||||
})
|
||||
if: ${{ failure() }}
|
||||
|
|
Загрузка…
Ссылка в новой задаче