Crowdin Action fails to detect existing pull request when using a non-main base branch and same-repo source branch
Chưa có ai nhận issue này.
- #288 của @casper-mercell — đã đóng, không merge
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- github, github-actions, shell
- Lĩnh vực
- ci-cd, localization
Hướng nghiên cứu
Bắt đầu với logic của action xây dựng yêu cầu curl tới PULLS_URL bằng các tham số base và head. Tái hiện trường hợp branch trong cùng repository với một branch cơ sở không phải là main, sau đó xác minh rằng một pull request hiện có được phát hiện và việc tạo mới được bỏ qua với thông báo log như mong đợi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
When the base branch for the pull request is not main (e.g., develop), the Crowdin GitHub Action fails to detect an existing pull request from a same-repo source branch (e.g., l10n_crowdin_translations). As a result, it attempts to create a new pull request and fails with a 422 Validation Failed error.
The issue likely occurs because the action uses head=ORG_NAME:BRANCH when calling the GitHub API to check for existing PRs.
To Reproduce
Steps to reproduce the behavior:
- Use the Crowdin GitHub Action with the following relevant configuration:
localization_branch_name: l10n_crowdin_translations
pull_request_base_branch_name: develop
create_pull_request: true
- Ensure that:
- A pull request already exists from l10n_crowdin_translations to develop
- Both branches exist in the same repository (not from a fork)
- Trigger the workflow again (either via schedule or manual dispatch)
Example workflow:
name: Crowdin Action Pull
on:
workflow_dispatch:
schedule:
- cron: '0 7,12 * * *'
jobs:
synchronize-with-crowdin:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: crowdin action
uses: crowdin/github-action@v2
with:
upload_sources: false
upload_translations: false
download_sources: true
download_translations: true
export_only_approved: true
localization_branch_name: l10n_crowdin_translations
pull_request_base_branch_name: develop
create_pull_request: true
push_sources: true
push_translations: true
pull_request_title: 'New Crowdin Translations'
pull_request_body: 'New Crowdin translations by [Crowdin GH Action](https://github.com/crowdin/github-action)'
pull_request_labels: 'Crowdin'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
Expected behavior
The action should detect that a pull request from l10n_crowdin_translations to develop already exists and skip creating a new one. It should log PULL REQUEST ALREADY EXIST instead of failing.
Screenshots
Relevant log from the failing repo:
PUSH TO BRANCH l10n_crowdin_translations
[l10n_crowdin_translations 5b7daab] New Crowdin translations by GitHub Action
1 file changed, 21 insertions(+), 21 deletions(-)
To https://github.com/XXX/YYY.git
+ 27f2ff2...5b7daab l10n_crowdin_translations -> l10n_crowdin_translations (forced update)
CHECK IF PULL REQUEST ALREADY EXIST
CREATE PULL REQUEST
FAILED TO CREATE PULL REQUEST
RESPONSE: {
"message": "Validation Failed",
"errors": [
{
"resource": "PullRequest",
"code": "custom",
"message": "A pull request already exists for XXX:l10n_crowdin_translations."
}
],
"documentation_url": "https://docs.github.com/rest/pulls/pulls#create-a-pull-request",
"status": "422"
}
Additional context
The bug appears in this part of the Crowdin action logic:
pull_requests_response=$(curl ... "${PULLS_URL}?base=${BASE_BRANCH}&head=${ORG_NAME}:${BRANCH}")
When changing into it works
"${PULLS_URL}?base=${BASE_BRANCH}&head=${BRANCH}"
I've verified this by forking the action and applying the fix — and the problem was resolved. The action correctly detects existing pull requests and avoids trying to create duplicates.
- Ngôn ngữ chính
- Shell
- Star
- 242
- Fork
- 68
- Merge trung bình
- 1 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của crowdin/github-action
-
bug good first issue hacktoberfest
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
crowdin/github-action#251 · 13 bình luận ·
-
Export settings issueĐang mởenhancement
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
crowdin/github-action#247 · 1 bình luận · 2 reaction ·
-
help wanted
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
crowdin/github-action#220 · 1 bình luận ·
-
macOS Runner SupportĐang mởenhancement help wanted
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
crowdin/github-action#160 · 3 bình luận · 1 reaction ·
-
API limitation enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
crowdin/github-action#35 · 7 bình luận · 26 reaction ·
Tất cả issue của crowdin/github-action
Issue tương tự
-
Update OpenShell to 0.1.5-pre.2Đang mởpackage-update
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
oSoWoSo/vOid_Community_repOsitory#436 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
hestiacp/hestiacp#5798 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Sourced-library load-guards use a top-level `return` that errors on direct execution (repo-wide)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
rossoctl/automation#115 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
obra/superpowers#2519 ·
Maintainer thường phản hồi trong vòng 1 ngày