Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Obtiene SHA correcto para calcular entradas faltantes#2751

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
rtobar merged 1 commit into3.12fromarregla-pr-comment
Nov 20, 2023

Conversation

rtobar
Copy link
Collaborator

La versión anterior usaba github.event.pull_request.merge_commit_sha para obtener el commit con el merge entre la rama origen y la rama destino. Sin embargo, este atributo no siempre está disponible. En primer lugar, el atributo puede ser un string o null:

https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=opened#pull_request

Y segundo, la documentación aclara que el atributo se establece sólo si el atributo "mergeable" es "true", lo cual no ocurre necesariamente de forma inmediate después de abrir un PR. Según
https://docs.github.com/en/free-pro-team@latest/rest/pulls/pulls?apiVersion=2022-11-28#get-a-pull-request:

"""
The value of the mergeable attribute can be true, false, or null. If the value is null, then GitHub has started a background job to compute the mergeability. After giving the job time to complete, resubmit the request. When the job finishes, you will see a non-null value for the mergeable attribute in the response. If mergeable is true, then merge_commit_sha will be the SHA of the test merge commit. """

Este delay en el cálculo de la mergeabilidad de los PRs es probablemente lo que está causando que nuestra acción no funcione como deseamos: al ejecutarse la primera vez cuando se abre el PR, la acción NO tiene un merge_commit_sha establecido, por lo que la acción "checkout" procede con el valor por defecto para el evento pull_request_target, que es la rama destino, por lo que todas las entradas aparecen como no traducidas.

Este commit cambia el SHA al que hacemos checkout al principio de esta acción para simplemente obtener el HEAD de la rama de origen. En retrospectiva, obtener el commit de merge no reporta beneficios.

mmmarcos and Sublian reacted with thumbs up emoji
La versión anterior usaba github.event.pull_request.merge_commit_shapara obtener el commit con el merge entre la rama origen y la ramadestino. Sin embargo, este atributo no siempre está disponible. Enprimer lugar, el atributo puede ser un string o null:https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=opened#pull_requestY segundo, la documentación aclara que el atributo se establece sólo siel atributo "mergeable" es "true", lo cual no ocurre necesariamente deforma inmediate después de abrir un PR. Segúnhttps://docs.github.com/en/free-pro-team@latest/rest/pulls/pulls?apiVersion=2022-11-28#get-a-pull-request:"""The value of the mergeable attribute can be true, false, or null. If thevalue is null, then GitHub has started a background job to compute themergeability. After giving the job time to complete, resubmit therequest. When the job finishes, you will see a non-null value for themergeable attribute in the response. If mergeable is true, thenmerge_commit_sha will be the SHA of the test merge commit."""Este delay en el cálculo de la mergeabilidad de los PRs es probablementelo que está causando que nuestra acción no funcione como deseamos: alejecutarse la primera vez cuando se abre el PR, la acción NO tiene unmerge_commit_sha establecido, por lo que la acción "checkout" procedecon el valor por defecto para el evento pull_request_target, que es larama destino, por lo que todas las entradas aparecen como no traducidas.Este commit cambia el SHA al que hacemos checkout al principio de estaacción para simplemente obtener el HEAD de la rama de origen. Enretrospectiva, obtener el commit de merge no reporta beneficios.Signed-off-by: Rodrigo Tobar <rtobar@icrar.org>
Copy link
Collaborator

@mmmarcosmmmarcos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

💯

@Sublian
Copy link
Contributor

Excellent 👌

@rtobarrtobar merged commitff774a0 into3.12Nov 20, 2023
@rtobarrtobar deleted the arregla-pr-comment branchNovember 20, 2023 22:45
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@mmmarcosmmmarcosmmmarcos approved these changes

@cmaureircmaureirAwaiting requested review from cmaureir

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@rtobar@Sublian@mmmarcos

[8]ページ先頭

©2009-2025 Movatter.jp