Skip to content

Commit

Permalink
attempt to fix "Body cannot be blank"
Browse files Browse the repository at this point in the history
This commit tries to fix a logic error where we `exit 1` if the diff or hd fails, but then the next step gets an empty env.UNICODE_HUMAN_RESULT and tries to write a comment to the PR with the empty string because I never appended it to the $GITHUB_ENV

 * BusKill/buskill-app#90 (comment)
 * https://github.com/BusKill/buskill-app/actions/runs/10306695941/job/28530322900?pr=90

2024-08-08T17:27:50.2608516Z WARNING: git diff failed!
2024-08-08T17:27:50.2611926Z ##[error]Process completed with exit code 1.
2024-08-08T17:27:50.2711200Z ##[group]Run actions/github-script@v5
2024-08-08T17:27:50.2711316Z with:
2024-08-08T17:27:50.2711670Z   github-token: ***
2024-08-08T17:27:50.2712275Z   script: github.rest.issues.createComment({
  issue_number: context.issue.number,
  owner: context.repo.owner,
  repo: context.repo.repo,
  body: ""
})

2024-08-08T17:27:50.2712365Z   debug: false
2024-08-08T17:27:50.2712473Z   user-agent: actions/github-script
2024-08-08T17:27:50.2712574Z   result-encoding: json
2024-08-08T17:27:50.2712881Z ##[endgroup]
2024-08-08T17:27:50.2812599Z ##[command]/usr/bin/docker exec  00316d800580718912b39a396d50ab0a80e9ce5a35ce56b9056c7315a6a097ca sh -c "cat /etc/*release | grep ^ID"
2024-08-08T17:27:50.5779265Z (node:3062) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
2024-08-08T17:27:50.5781733Z (Use `node --trace-deprecation ...` to show where the warning was created)
2024-08-08T17:27:50.9059683Z RequestError [HttpError]: Validation Failed: {"resource":"IssueComment","code":"unprocessable","field":"data","message":"Body cannot be blank"}
2024-08-08T17:27:50.9061478Z     at /__w/_actions/actions/github-script/v5/dist/index.js:4560:21
2024-08-08T17:27:50.9062520Z     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
2024-08-08T17:27:50.9063394Z   status: 422,
2024-08-08T17:27:50.9063760Z   response: {
2024-08-08T17:27:50.9064575Z     url: 'https://api.github.com/repos/BusKill/buskill-app/issues/90/comments',
2024-08-08T17:27:50.9065361Z     status: 422,
2024-08-08T17:27:50.9065747Z     headers: {
2024-08-08T17:27:50.9066254Z       'access-control-allow-origin': '*',
2024-08-08T17:27:50.9069389Z       'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
2024-08-08T17:27:50.9072239Z       'content-length': '247',
2024-08-08T17:27:50.9072941Z       'content-security-policy': "default-src 'none'",
2024-08-08T17:27:50.9073774Z       'content-type': 'application/json; charset=utf-8',
2024-08-08T17:27:50.9074524Z       date: 'Thu, 08 Aug 2024 17:27:50 GMT',
2024-08-08T17:27:50.9075535Z       'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
2024-08-08T17:27:50.9076469Z       server: 'github.com',
2024-08-08T17:27:50.9077332Z       'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
2024-08-08T17:27:50.9078374Z       vary: 'Accept-Encoding, Accept, X-Requested-With',
2024-08-08T17:27:50.9079353Z       'x-accepted-github-permissions': 'issues=write; pull_requests=write',
2024-08-08T17:27:50.9080287Z       'x-content-type-options': 'nosniff',
2024-08-08T17:27:50.9080911Z       'x-frame-options': 'deny',
2024-08-08T17:27:50.9081560Z       'x-github-api-version-selected': '2022-11-28',
2024-08-08T17:27:50.9082282Z       'x-github-media-type': 'github.v3',
2024-08-08T17:27:50.9083482Z       'x-github-request-id': 'D080:6F0B2:17F711F0:2CB179B2:66B50016',
2024-08-08T17:27:50.9084363Z       'x-ratelimit-limit': '5000',
2024-08-08T17:27:50.9084980Z       'x-ratelimit-remaining': '4999',
2024-08-08T17:27:50.9085379Z       'x-ratelimit-reset': '1723141670',
2024-08-08T17:27:50.9085756Z       'x-ratelimit-resource': 'core',
2024-08-08T17:27:50.9086118Z       'x-ratelimit-used': '1',
2024-08-08T17:27:50.9086433Z       'x-xss-protection': '0'
2024-08-08T17:27:50.9086693Z     },
2024-08-08T17:27:50.9086878Z     data: {
2024-08-08T17:27:50.9087138Z       message: 'Validation Failed',
2024-08-08T17:27:50.9087440Z       errors: [Array],
2024-08-08T17:27:50.9088003Z       documentation_url: 'https://docs.github.com/rest/issues/comments#create-an-issue-comment',
2024-08-08T17:27:50.9088572Z       status: '422'
2024-08-08T17:27:50.9088795Z     }
2024-08-08T17:27:50.9089404Z   },
2024-08-08T17:27:50.9089613Z   request: {
2024-08-08T17:27:50.9089861Z     method: 'POST',
2024-08-08T17:27:50.9090326Z     url: 'https://api.github.com/repos/BusKill/buskill-app/issues/90/comments',
2024-08-08T17:27:50.9090796Z     headers: {
2024-08-08T17:27:50.9091318Z       accept: 'application/vnd.github.-preview+json',
2024-08-08T17:27:50.9092180Z       'user-agent': 'actions/github-script octokit-core.js/3.5.1 Node.js/20.13.1 (linux; x64)',
2024-08-08T17:27:50.9093346Z       authorization: 'token [REDACTED]',
2024-08-08T17:27:50.9093784Z       'content-type': 'application/json; charset=utf-8'
2024-08-08T17:27:50.9094130Z     },
2024-08-08T17:27:50.9094361Z     body: '{"body":""}',
2024-08-08T17:27:50.9094739Z     request: { agent: [Agent], hook: [Function: bound bound register] }
2024-08-08T17:27:50.9095138Z   }
2024-08-08T17:27:50.9095317Z }
2024-08-08T17:27:50.9100654Z ##[error]Unhandled error: HttpError: Validation Failed: {"resource":"IssueComment","code":"unprocessable","field":"data","message":"Body cannot be blank"}
  • Loading branch information
maltfield committed Aug 8, 2024
1 parent f2448ba commit 521a642
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/unicode_warn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
if [ $? -ne 0 ]; then
# there was an error in the diff
human_result="WARNING: git diff failed!"
echo "UNICODE_HUMAN_RESULT=${human_result}" >> $GITHUB_ENV
echo "${human_result}"
exit 1
fi
Expand All @@ -70,6 +71,7 @@ jobs:
if [ $? -ne 0 ]; then
# there was an error in the hexdump
human_result="WARNING: hexdump failed!"
echo "UNICODE_HUMAN_RESULT=${human_result}" >> $GITHUB_ENV
echo "${human_result}"
exit 1
fi
Expand Down Expand Up @@ -114,7 +116,7 @@ jobs:
- name: Exit with or without error
run: |
if [[ "${{ env.UNICODE_HUMAN_RESULT }}" | grep -i "WARNING" ]]; then
if [[ "${{ env.UNICODE_HUMAN_RESULT }}" | grep -Ei "ERROR|WARNING" ]]; then
exit 1
else
exit 0
Expand Down

0 comments on commit 521a642

Please sign in to comment.