crowdin / github-action

A GitHub action to manage and synchronize localization resources with your Crowdin project
https://crowdin.com
MIT License
164 stars 56 forks source link

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

Closed UladzimirVyaziginTR closed 2 months ago

UladzimirVyaziginTR commented 3 months ago

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 https://github.com/crowdin/github-action/issues/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 commented 3 months ago

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 commented 3 months ago

@UladzimirVyaziginTR thanks for the details!

I think we should add error handling here:

https://github.com/crowdin/github-action/blob/6ed209d411599a981ccb978df3be9dc9b8a81699/entrypoint.sh#L115

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