Crowdin Action fails to detect existing pull request when using a non-main base branch and same-repo source branch
还没有人认领这个 Issue。
- #288 来自 @casper-mercell —— 已关闭,未合并
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 30/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- github, github-actions, shell
- 领域
- ci-cd, localization
调研方向
从使用 base 和 head 参数构建发往 PULLS_URL 的 curl 请求的 action 逻辑开始。复现同一存储库中使用非 main 基础分支的分支情况,然后验证能够检测到现有的 pull request,并使用预期的日志消息跳过创建。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Shell
- 星标
- 242
- 派生
- 68
- 平均合并
- 1 分钟
- 30 天内合并 PR
- 1
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
crowdin/github-action 的其他 Issue
-
bug good first issue hacktoberfest
难度 2/5 1-3 小时 新手友好度 45/100
crowdin/github-action#251 · 13 条评论 ·
-
enhancement
难度 3/5 1-2 天 新手友好度 42/100
crowdin/github-action#247 · 1 条评论 · 2 个 reaction ·
-
help wanted
难度 3/5 1-2 天 新手友好度 38/100
crowdin/github-action#220 · 1 条评论 ·
-
enhancement help wanted
难度 5/5 一周以上 新手友好度 25/100
crowdin/github-action#160 · 3 条评论 · 1 个 reaction ·
-
API limitation enhancement
难度 4/5 3-5 天 新手友好度 35/100
crowdin/github-action#35 · 7 条评论 · 26 个 reaction ·
查看 crowdin/github-action 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
interledger/rhyza#352 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
beehive-lab/TornadoVM#1248 ·
维护者通常 1 天内回复
-
Dev
难度 2/5 1-3 小时 新手友好度 62/100
ankidroid/Anki-Android#22555 ·
维护者通常 1 天内回复
-
difficulty: easy domain: devops effort: 1-4h enhancement good first issue smart-contracts Stellar Wave
难度 2/5 1-3 小时 新手友好度 72/100
Kaycee276/Chesster#469 · 2 条评论 ·
维护者通常 1 天内回复
-
Add .gitignore可能已有人在做 @ajeanmahoney 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 88/100