Open ricardo-dematos opened 1 year ago
Not sure offhand.
It's possible it's this: https://github.com/check-spelling/check-spelling/blob/d7cd2973c513e84354f9d6cf50a6417a628a78ce/unknown-words.sh#L222
Could you set debug: 1
?
https://github.com/check-spelling/check-spelling/blob/d7cd2973c513e84354f9d6cf50a6417a628a78ce/action.yml#L34-L36
I'm sorry @jsoref , but my permissions to directly commit to a repo were revoked and since the team doesn't consider this a priority, I cannot afford to create a pull request to do your test... 😞
Hmm. Sorry to hear that. I'd be curious to know if you can reproduce in a fork of their repository with actions enabled. Or if the repository is something I can see, maybe a pointer and I can try to tinker with it.
Either way, thanks for reporting.
Hmm. Sorry to hear that. I'd be curious to know if you can reproduce in a fork of their repository with actions enabled. Or if the repository is something I can see, maybe a pointer and I can try to tinker with it.
It's commercial software, so almost all repo's are private and non forkable.
Personally, I consider 2 types of typos:
The latter one reveals someone that types fast and doesn't review what it writes or someone on a tight schedule. Either way, if it didn't pay attention to what it was written, how confident can another one be in that code? Are the typos the only errors?
OK. After spending a lot of time today thinking about this problem, I have a guess about what's happening...
jq
For my reference, here's how one generally speaking gets the error in this issue:
(input=$(mktemp); (echo '{'; echo '"one": "hi",'; echo '"two": "three"'; echo '}') > $input; jq '.one.hi // empty' $input; grep -n . $input)
jq: error (at /var/folders/r3/n29fz25x72x191fdv6mhhr3m0000gp/T/tmp.xacwS27O9i:4): Cannot index string with string "hi"
1:{
2:"one": "hi",
3:"two": "three"
4:}
The number 4
really does end up being the line count of the file.
(input=$(mktemp); (echo '[';echo '{'; echo '"one": "hi",'; echo '"a": "b",';echo '"two": "three"'; echo '}'; echo ']') > $input; jq '.[0].one.hi // empty' $
input; grep -n . $input)
jq: error (at /var/folders/r3/n29fz25x72x191fdv6mhhr3m0000gp/T/tmp.ThKPqJ4ZpX:7): Cannot index string with string "hi"
1:[
2:{
3:"one": "hi",
4:"a": "b",
5:"two": "three"
6:}
7:]
Warning: while the number 4
is key, I don't think anyone running v0.0.21 today would see 4
, instead, I think they'd see 5
.
That's because, I believe this is actually a permissions error (the fact that this was a private repository hinted at that).
Here's a random ticket that shows what permission errors used to look like:
{
"message": "Not Found",
"documentation_url": "https://docs.github.com/rest/collaborators/collaborators#add-a-repository-collaborator"
}
git blame v0.0.21 -- unknown-words.sh|grep -n . |perl -pe 's/ unknown-words\.sh\s*\(.*?\)//'| grep -C3 '\.user'
Sorting blocks from least likely to hardest to immediately rule out...
.issue.user.login
669:3ed5d5f59a
670:91d4beb7be trigger_comment_url="$(jq -r '.url // empty' "$comment")"
671:91d4beb7be sender_login="$(jq -r '.sender.login // empty' "$GITHUB_EVENT_PATH")"
672:91d4beb7be issue_user_login="$(jq -r '.issue.user.login // empty' "$GITHUB_EVENT_PATH")"
673:91d4beb7be pull_request_head_info="$(mktemp_json)"
674:eb9549b783 jq .head "$pull_request_info" > "$pull_request_head_info"
675:91d4beb7be pull_request_sha="$(jq -r '.sha // empty' "$pull_request_head_info")"
$GITHUB_EVENT_PATH
should have a different path format, which more or less rules this out.sender.login
would have failed.user.id
in track_comment
2352:af30e6ff6b track_comment() {
2353:91d4beb7be HTML_COMMENT_URL="$(jq -r '.html_url // empty' "$response")"
2354:91d4beb7be echo "Comment posted to ${HTML_COMMENT_URL:-"$COMMENT_URL"}"
2355:4b237d4692 comment_author_id="$(jq -r '.user.id // empty' "$response")"
2356:4b237d4692 posted_comment_node_id="$(jq -r '.node_id // empty' "$response")"
2357:af30e6ff6b }
2358:af30e6ff6b
.html_url
would have failed.user.login
751:91d4beb7be comment "$comment_url" > "$comment" ||
752:5579450a28 confused_comment "$trigger_comment_url" "Failed to retrieve $b$comment_url$b."
753:5579450a28
754:91d4beb7be bot_comment_author=$(jq -r '.user.login // empty' "$comment")
755:91d4beb7be bot_comment_node_id=$(jq -r '.node_id // empty' "$comment")
756:91d4beb7be bot_comment_url=$(jq -r '.issue_url // .comment.url' "$comment")
757:5579450a28 github_actions_bot="github-actions[bot]"
.user
.user.id
in jq_comment_query
219:4b237d4692 # from that element, we only want the node_id
220:4b237d4692 # we want the last element
221:4b237d4692 # if there's no element, we want the empty string (not 'null')
222:4b237d4692 jq_comment_query='[ .[] | select(. | (.user.id=='"${comment_author_id:-0}"') and (.node_id != "'"$posted_comment_node_id"'") and (.body | test ("'"$comment_search_re"'") ) ) | .node_id ] | .[-1] // empty'
223:4b237d4692
224:4b237d4692 get_page() {
225:4b237d4692 url="$1"
This is fancier, specifically, it's expecting an array of objects.
But, what if the returned item is instead an object? Specifically that error object?
curl -q -s https://api.github.com/repos/check-spelling-sandbox/no-such-repository/pulls|jq '[ .[] | select(. | (.user.id=='2'))]'
jq: error (at <stdin>:5): Cannot index string with string "user"
So, this is approximately the right shape of an error. The line number is wrong because GitHub added a status
field a while ago, but here's what the api sent:
curl -q -s https://api.github.com/repos/check-spelling-sandbox/no-such-repository/pulls
{
"message": "Not Found",
"documentation_url": "https://docs.github.com/rest/pulls/pulls#list-pull-requests",
"status": "404"
}
Unfortunately, I can't get this to happen. I've tried using v0.0.21 with various permissions. (I'm pretty sure I tried when this was opened too.)
I wonder if it could happen if I didn't use the default GITHUB_TOKEN
...
The other exciting edge about this ticket is:
event_aliases: {"workflow_call":"push"}
I still haven't played with workflow_call
much. It's by far one of the fancier GitHub features I've basically never used.
At some point, I'm going to have to try setting up a workflow_call
flow and seeing how check-spelling works there.
With release
0.0.21
I'm gettingError: jq: error (at /tmp/tmp.cGzaIQjE6g.json:4): Cannot index string with string "user"
.There's just an annotation in job summary, because the step outcome is
success
.Here's the step log :