Crowdin Action fails to detect existing pull request when using a non-main base branch and same-repo source branch
まだ誰も着手していません。
- #288 @casper-mercell による — マージされずにクローズ
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 30/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- github, github-actions, shell
- 領域
- ci-cd, localization
調査の方向性
base パラメーターと head パラメーターを使用して PULLS_URL への curl リクエストを構築するアクションロジックから始めます。同じリポジトリ内の、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
- フォーク
- 69
- 平均マージ
- 1分
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 件 ·
-
help wanted
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
crowdin/github-action#220 · コメント 1 件 ·
-
macOS Runner Supportオープンenhancement help wanted
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
crowdin/github-action#160 · コメント 3 件 · リアクション 1 件 ·
-
API limitation enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
crowdin/github-action#35 · コメント 7 件 · リアクション 26 件 ·
crowdin/github-action の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
docs(evals): note CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS for headless eval runs that use workflowsオープンgood first issue needs-triage priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
melodic-software/claude-code-plugins#7022 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
ready
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
kubeflow/pipelines#14784 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
implement-spec: step 9 cleanup collides with branch -D guards and with rewritten integration historyオープンneeds-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
mattpocock/skills#1251 ·
メンテナーはふだん 1 日以内に返信