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

fix the check run filter by id #18650

Merged
merged 2 commits into from
May 23, 2024

Conversation

saurabh-git-dev
Copy link
Contributor

@saurabh-git-dev saurabh-git-dev commented May 20, 2024

Closes #18648

Description

This issue is due to filtering by check-run "name" instead of filtering by "id". It is replaced with "id" as we get check-run "id" in the API response(Attached API ref.).

If we change the name with id. We can see all the jobs with the same name.

API Ref:

https://docs.github.com/en/rest/checks/runs?apiVersion=2022-11-28#list-check-runs-for-a-git-reference

Screenshots

image

Copy link

@Chukwumaelesachi Chukwumaelesachi left a comment

Choose a reason for hiding this comment

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

Approve

@niik
Copy link
Member

niik commented May 22, 2024

Hey @saurabh-git-dev, thanks so much for taking the time to contribute to Desktop!

I believe this change makes sense but I'd really like for @tidy-dev (the original author of this) to take a look as well. My concern is centered around the fact that we named this function getLatestCheckRunsByName so I want to make sure that id is a suitable replacement. If it is then we should update the name of the function as well.

@niik niik requested a review from tidy-dev May 22, 2024 10:40
@tidy-dev
Copy link
Contributor

I did some digging to see if I could find reasoning for using the name versus the id. (I couldn't remember this method)

@niik you are the original author of the function for the pr status work.

https://github.com/desktop/desktop/blame/36e957897eae6d4a491ddd6dd41fb119f0f1a12e/app/src/lib/stores/commit-status-store.ts

I only added filter based on if it was a push or a pull.

1eed3bc#diff-e3f9f5058c055c6e578c6019115cad54a10a80455eeeb4c4afca17df1b86150cL352

Looking at the docs, I cannot see a reason not to use id here instead of name.

Copy link
Contributor

@tidy-dev tidy-dev left a comment

Choose a reason for hiding this comment

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

@saurabh-git-dev Could you please update the function name to getLatestCheckRunsById?

@saurabh-git-dev
Copy link
Contributor Author

I actually had the same thought as to why the "id" was not used.
If we take a look in detail there are one more issue due to the "name". It's not the single place where "name" is used. the workflows are also grouped by names instead of by "id". That is why if there are 2 workflows with the same name, they will appear in a single group.

In the shared picture there are 2 jobs with the same name. And also the same workflow name. That's why appear in a 'Test' group.

I looked at the grouping method. But it is used in many places. So did not change that.
Group Method -

export function getCheckRunsGroupedByActionWorkflowNameAndEvent(

Although there is not a big impact with the grouping issue.

method name changed and formatted the code.
Copy link
Contributor

@tidy-dev tidy-dev left a comment

Choose a reason for hiding this comment

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

💖 Thanks for the fix.

I tested across GitHub Action and Non-GitHub Action checks and works as expected.

Sounds like it would be more accurate to use id for unique workflow names as well.

@tidy-dev tidy-dev merged commit 6945d86 into desktop:development May 23, 2024
7 checks passed
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.

Unable to see all the actions check-runs with same job name
5 participants