Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add 3d-print docs #90

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open

add 3d-print docs #90

wants to merge 6 commits into from

Conversation

goldfishlaser
Copy link
Member

create file based on storage.rst to start working on 3d printed buskill installation instructions

@goldfishlaser
Copy link
Member Author

@maltfield I'm not sure what's going on here can you check on it?

goldfishlaser

This comment was marked as resolved.

@maltfield
Copy link
Member

@goldfishlaser what do you want me to check-on?

@goldfishlaser
Copy link
Member Author

goldfishlaser commented Aug 7, 2024 via email

@maltfield
Copy link
Member

@maltfield
Copy link
Member

maltfield commented Aug 7, 2024

I think I've fixed the (malicious) unicode checker workflow. I think it was an issue with new github actions permissions and also the new safe.directory git config that was breaking the diff. For more info, see:

@maltfield
Copy link
Member

I also added some better error codes and some better ways to trigger it to re-run. One thing that'll cause it to re-run is by unlocking a PR, so I'm going to toggle that to force it to re-run on this PR.

@BusKill BusKill locked and limited conversation to collaborators Aug 7, 2024
@BusKill BusKill unlocked this conversation Aug 7, 2024
maltfield added a commit that referenced this pull request Aug 7, 2024
This commit attempts to update the (malicious) unicode detection workflow to fix an error on diff

 * #90
 * https://github.com/BusKill/buskill-app/actions/runs/10290611003/job/28481143563?pr=90

  2024-08-07T19:38:13.0639703Z + git branch -a
  2024-08-07T19:38:13.0661153Z * master
  2024-08-07T19:38:13.0662070Z   remotes/origin/HEAD -> origin/master
  2024-08-07T19:38:13.0662923Z   remotes/origin/dev
  2024-08-07T19:38:13.0663562Z   remotes/origin/font_setting
  2024-08-07T19:38:13.0664273Z   remotes/origin/gh-pages
  2024-08-07T19:38:13.0665072Z   remotes/origin/master
  2024-08-07T19:38:13.0665603Z   remotes/origin/v0.1.0
  2024-08-07T19:38:13.0666164Z   remotes/origin/v0.2.0
  2024-08-07T19:38:13.0666849Z   remotes/origin/v0.2.1
  2024-08-07T19:38:13.0667376Z   remotes/origin/v0.3.0
  2024-08-07T19:38:13.0667958Z   remotes/origin/v0.3.1
  2024-08-07T19:38:13.0668493Z   remotes/origin/v0.4.0
  2024-08-07T19:38:13.0668961Z   remotes/origin/v0.5.0
  2024-08-07T19:38:13.0669349Z   remotes/origin/v0.6.0
  2024-08-07T19:38:13.0670119Z   remotes/origin/v0.7.0
  ...
  2024-08-07T19:38:13.1733843Z ++ git diff --unified=0 924ca98 43dfed1
  2024-08-07T19:38:13.1734022Z ++ grep -Ev '^(--- a/|\+\+\+ b/)'
  2024-08-07T19:38:13.1734246Z fatal: bad object 43dfed1
  2024-08-07T19:38:13.1734418Z ++ grep -E '^[+]'
  2024-08-07T19:38:13.1734545Z + diff=
  2024-08-07T19:38:13.1734685Z + '[' 1 -ne 0 ']'
  2024-08-07T19:38:13.1734986Z + human_result='WARNING: git diff failed!'
  2024-08-07T19:38:13.1735154Z + echo 'WARNING: git diff failed!'
  2024-08-07T19:38:13.1735292Z + exit 1

Since it says there was a "bad object" -- let's try changing to the correct branch first
@BusKill BusKill locked and limited conversation to collaborators Aug 7, 2024
@BusKill BusKill unlocked this conversation Aug 7, 2024
maltfield added a commit that referenced this pull request Aug 7, 2024
I'm hoping that when Melanie pushes a new change, it'll "just work". We'll seee

 * #90
@maltfield
Copy link
Member

looks like I can't trigger it on my end because it can't find Melanie's commit, which causes the diff to fail.

@goldfishlaser can you please push a trivial commit (just a newline or something) to see if the unicode_warn workflow works?

@maltfield
Copy link
Member

maltfield added a commit to maltfield/detect-malicious-unicode that referenced this pull request Aug 8, 2024
This commit adds some debugging (to print the full JSON github context vars) and attempts to checkout the head ref before attempting to do a diff. Hopefully this will fix issues of "object not found" because the diff is currently being done in the repo's default branch (main or master), but that won't work if the PR is being submitted to a different branch (eg 'dev') or, maybe, if the PR is being submitted from a different branch.

See also

 * https://stackoverflow.com/questions/70104600/complete-list-of-github-actions-contexts
 * #4
 * BusKill/buskill-app#90 (comment)
@BusKill BusKill locked and limited conversation to collaborators Aug 8, 2024
@BusKill BusKill unlocked this conversation Aug 8, 2024
maltfield added a commit to maltfield/detect-malicious-unicode that referenced this pull request Aug 8, 2024
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"}
@BusKill BusKill locked and limited conversation to collaborators Aug 8, 2024
@BusKill BusKill unlocked this conversation Aug 8, 2024
Copy link

github-actions bot commented Aug 8, 2024

WARNING: git diff failed!

maltfield added a commit to maltfield/detect-malicious-unicode that referenced this pull request Aug 8, 2024
 * BusKill/buskill-app#90 (comment)
 * https://github.com/BusKill/buskill-app/actions/runs/10306855519/job/28530828444?pr=90

  2024-08-08T17:39:22.5370542Z ##[group]Run if [[ "WARNING: git diff failed!" | grep -Ei "ERROR|WARNING" ]]; then
  2024-08-08T17:39:22.5371079Z [36;1m[0m
  2024-08-08T17:39:22.5371457Z [36;1mif [[ "WARNING: git diff failed!" | grep -Ei "ERROR|WARNING" ]]; then[0m
  2024-08-08T17:39:22.5371917Z [36;1m  exit 1[0m
  2024-08-08T17:39:22.5372141Z [36;1melse[0m
  2024-08-08T17:39:22.5372356Z [36;1m  exit 0[0m
  2024-08-08T17:39:22.5372651Z shell: bash {0}
  2024-08-08T17:39:22.5372864Z env:
  2024-08-08T17:39:22.5373114Z   UNICODE_HUMAN_RESULT: WARNING: git diff failed!
  2024-08-08T17:39:22.5373466Z ##[endgroup]
  2024-08-08T17:39:22.6145287Z /__w/_temp/8a48bf26-0dbe-4e74-bfec-9efb78fd13c5.sh: line 2: unexpected token `|', conditional binary operator expected
  2024-08-08T17:39:22.6147084Z /__w/_temp/8a48bf26-0dbe-4e74-bfec-9efb78fd13c5.sh: line 2: syntax error near `|'
  2024-08-08T17:39:22.6148958Z /__w/_temp/8a48bf26-0dbe-4e74-bfec-9efb78fd13c5.sh: line 2: `if [[ "WARNING: git diff failed!" | grep -Ei "ERROR|WARNING" ]]; then'
  2024-08-08T17:39:22.6172279Z ##[error]Process completed with exit code 2.
@maltfield
Copy link
Member

Update: Still working on fixing the unicode warning CI script. Good news is that I at least got better error reporting working; it left a comment above saying that the diff failed. Progress..

@BusKill BusKill locked and limited conversation to collaborators Aug 8, 2024
@BusKill BusKill unlocked this conversation Aug 8, 2024
Copy link

github-actions bot commented Aug 8, 2024

WARNING: git diff failed!

(source)

@BusKill BusKill locked and limited conversation to collaborators Aug 8, 2024
@BusKill BusKill unlocked this conversation Aug 8, 2024
Copy link

github-actions bot commented Aug 8, 2024

^^ WARNING: Unicode characters found in diff!

(source)

@maltfield
Copy link
Member

maltfield commented Aug 8, 2024

ok, I fixed the unicode workflow. And, actually, it found some non-ascii text in your PR

2024-08-08T21:13:32.8764352Z + unicode_diff=$'\357\273\277'
2024-08-08T21:13:32.8764454Z + unicode_grep_exit_code=0
2024-08-08T21:13:32.8764569Z + echo $'\357\273\277'
2024-08-08T21:13:32.8764696Z ++ echo -n $'\357\273\277'
2024-08-08T21:13:32.8764773Z ++ hd
2024-08-08T21:13:32.8765100Z + unicode_diff_hexdump='00000000  ef bb bf                                          |...|
2024-08-08T21:13:32.8765183Z 00000003'
2024-08-08T21:13:32.8765291Z + '[' 0 -ne 0 ']'
2024-08-08T21:13:32.8765539Z + echo '00000000  ef bb bf                                          |...|
2024-08-08T21:13:32.8765626Z 00000003'
2024-08-08T21:13:32.8765802Z + [[ 00000000  ef bb bf                                          |...|
2024-08-08T21:13:32.8765907Z 00000003 == '' ]]
2024-08-08T21:13:32.8766148Z + human_result='^^ WARNING: Unicode characters found in diff!'

It's the first 3 bytes of the file (0xef, 0xbb, and 0xbf).

00000000  ef bb bf 2e 2e 20 5f 75  73 62 5f 73 74 6f 72 61  |..... _usb_stora|

I thought that maybe this was output from diff, but it is in-fact present in the file. Note that the file "appears" to start with with two dots and a space .. , but it actually has these three bytes before that

user@disp6631:~/Downloads/sandbox/buskill-app$ cat docs/hardware_dev/3d-print.rst | head
.. _usb_storage_initialization:

Build a 3D-Printed BusKill Instructions
=================================

This section will describe how format the USB storage drive and put the BusKill software on it.

.. note::
  The BusKill software cannot run on the USB drive. It must be run from your computer.

user@disp6631:~/Downloads/sandbox/buskill-app$ 

user@disp6631:~/Downloads/sandbox/buskill-app$ cat docs/hardware_dev/3d-print.rst | hd | head
00000000  ef bb bf 2e 2e 20 5f 75  73 62 5f 73 74 6f 72 61  |..... _usb_stora|
00000010  67 65 5f 69 6e 69 74 69  61 6c 69 7a 61 74 69 6f  |ge_initializatio|
00000020  6e 3a 0a 0a 42 75 69 6c  64 20 61 20 33 44 2d 50  |n:..Build a 3D-P|
00000030  72 69 6e 74 65 64 20 42  75 73 4b 69 6c 6c 20 49  |rinted BusKill I|
00000040  6e 73 74 72 75 63 74 69  6f 6e 73 0a 3d 3d 3d 3d  |nstructions.====|
00000050  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
00000060  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 0a 0a 54  |=============..T|
00000070  68 69 73 20 73 65 63 74  69 6f 6e 20 77 69 6c 6c  |his section will|
00000080  20 64 65 73 63 72 69 62  65 20 68 6f 77 20 66 6f  | describe how fo|
00000090  72 6d 61 74 20 74 68 65  20 55 53 42 20 73 74 6f  |rmat the USB sto|
user@disp6631:~/Downloads/sandbox/buskill-app$ 

Please remove this from the file.

@maltfield
Copy link
Member

Update: oh, I think it's this

Copy link

INFO: No unicode characters found in PR's commits

(source)

Copy link

^^ WARNING: Unicode characters found in diff!

(source)

Copy link

^^ WARNING: Unicode characters found in diff!

(source)

Copy link

^^ WARNING: Unicode characters found in diff!

(source)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants