Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the /git-artifacts PR comment even in cascading runs #47

Merged

Conversation

dscho
Copy link
Member

@dscho dscho commented Nov 10, 2023

When a /git-artifacts is issued with an existing corresponding tag-git run, the respective comment is updated immediately with links to the git-artifacts-* runs.

However, when that tag-git run does not exist, the comment is updated with a link to the newly-triggered tag-git run, and when that run's completion triggers the "cascading" git-artifacts-* runs, the PR comment is no longer updated.

This is unfortunate because that information is rather valuable and saves time e.g. when trying to manually validate the generated installer.

So let's try a little harder to find that comment, and update it.

This fixes #38.

…mmit SHA

To update the `/git-artifacts` comment when cascading
`git-artifacts-<arch>` runs are triggered, we need a way to get from the
commit SHA (which is part of the `check_run.completed` webhook) to the
corresponding PR comment ID.

Here, we introduce a function to do that, by using GitHub API's search
functionality. The commit SHA is given verbatim, which should be good
enough according to the documentation at
https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests#search-by-commit-sha

Further, we make use of the text match metadata
(https://docs.github.com/en/rest/search/search#text-match-metadata) to
match the desired PR comment and to extract the PR comment ID.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
…eliably

When `/git-artifacts` has to trigger a `tag-git` run first, the actual
`git-artifacts-<arch>` jobs are triggered as "cascading runs". At that
stage, the connection to the original PR comment ID is lost, and
therefore that comment is no longer updated to link to those
`git-artifacts-<arch>` runs.

With this patch, GitForWindowsHelper learns to find that PR comment ID
when a completed `tag-git` check run triggers the `git-artifacts-` runs
and then to update that comment accordingly.

This addresses git-for-windows#38

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho dscho requested a review from rimrul November 10, 2023 22:35
@dscho dscho self-assigned this Nov 10, 2023
@dscho dscho merged commit 2be02dc into git-for-windows:main Nov 11, 2023
1 check passed
@dscho dscho deleted the update-tag-git-comment-in-cascading-runs branch November 11, 2023 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add git-artifacts run links more reliably
2 participants