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

jq: error (at <stdin>:5): Cannot index string with string "head" #241

Closed
UladzimirVyaziginTR opened this issue Aug 9, 2024 · 2 comments · Fixed by #250
Closed

jq: error (at <stdin>:5): Cannot index string with string "head" #241

UladzimirVyaziginTR opened this issue Aug 9, 2024 · 2 comments · Fixed by #250
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@UladzimirVyaziginTR
Copy link

Describe the bug

  1. We are observing this issue during the attempt to create PR in GitHub via github-action.
  2. The custom branch with translation files was created successfully but PR is not created.
  3. Fine-grained PAT has write permission on the contents and pull-requests as it is described in https://github.com/crowdin/github-action?tab=readme-ov-file#permissions
  4. Similar issues has been raised a lot of time ago but the thread does not contain anything valuable inside Crowdin Action does not create PR and fails with error: jq: error (at <stdin>:4): Cannot index string with string "head" #67

To Reproduce
Steps to reproduce the behavior:

  1. Set up a workflow in .github/workflows/crowdin.yml as it is described in https://github.com/crowdin/github-action?tab=readme-ov-file#usage
  2. crowdin init

Expected behavior
PR is created.

@UladzimirVyaziginTR UladzimirVyaziginTR added the bug Something isn't working label Aug 9, 2024
@UladzimirVyaziginTR
Copy link
Author

The problem was tied with incorrectly specified branch. We had "main" instead of "master" in configuration file. The problem is not valid anymore.

@andrii-bodnar
Copy link
Member

@UladzimirVyaziginTR thanks for the details!

I think we should add error handling here:

PULL_REQUESTS=$(echo "$(curl -sSL -H "${AUTH_HEADER}" -H "${HEADER}" -X GET "${PULLS_URL}${PULL_REQUESTS_QUERY_PARAMS}")" | jq --raw-output '.[] | .head.ref ')

GitHub probably returns some error message in the response, but we try to access head.ref and fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants