Crowdin Action fails to detect existing pull request when using a non-main base branch and same-repo source branch
Nadie ha tomado este issue todavía.
- #288 de @casper-mercell — cerrado sin fusionar
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 30/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- github, github-actions, shell
- Área
- ci-cd, localization
Línea de trabajo
Comienza con la lógica de la acción que construye la solicitud curl a PULLS_URL usando los parámetros base y head. Reproduce el caso de un branch del mismo repositorio con un branch base que no sea main y, después, verifica que se detecte un pull request existente y que se omita la creación con el mensaje de log esperado.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Shell
- Estrellas
- 242
- Forks
- 69
- Merge medio
- 1 min
- PR fusionados (30 d)
- 1
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de crowdin/github-action
-
bug good first issue hacktoberfest
Dificultad 2/5 1-3 horas Aptitud para principiantes 45/100
crowdin/github-action#251 · 13 comentarios ·
-
Export settings issueAbiertoenhancement
Dificultad 3/5 1-2 días Aptitud para principiantes 42/100
crowdin/github-action#247 · 1 comentario · 2 reacciones ·
-
help wanted
Dificultad 3/5 1-2 días Aptitud para principiantes 38/100
crowdin/github-action#220 · 1 comentario ·
-
macOS Runner SupportAbiertoenhancement help wanted
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
crowdin/github-action#160 · 3 comentarios · 1 reacción ·
-
API limitation enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
crowdin/github-action#35 · 7 comentarios · 26 reacciones ·
Todos los issues de crowdin/github-action
Issues similares
-
Package for AUR (Arch Linux)Abiertogood first issue need help packaging
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
phonology024/babelscribe#23 ·
-
enhancement
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
rios0rios0/pipelines#726 ·
Los mantenedores suelen responder en 1 día
-
Add missing Cloud Routes keysAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
influxdata/openapi#660 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 3 días