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(check-status): add null check for commit status rollup #41

Merged
merged 2 commits into from
Nov 1, 2023

Conversation

capthiron
Copy link
Contributor

This is related to #39.

This commit addresses a TypeError that occurs when trying to access the 'state' property of 'commit.statusCheckRollup' when it is null. A conditional check is added to ensure 'commit.statusCheckRollup' is not null before attempting to access 'state'. This prevents the TypeError and provides a more informative message when 'commit.statusCheckRollup' is null.

However, this would not solve the underlying issue of why commit.statusCheckRollup is null when it shouldn't be (see #39).

Also, if commit.statusCheckRollup being null is a valid state that indicates a certain condition (e.g., the CI status check has not been run yet), then the logic within checkStatus() may need to be updated to handle this condition appropriately.

This commit addresses a TypeError that occurs when trying to access the 'state' property of 'commit.statusCheckRollup' when it is null. A conditional check is added to ensure 'commit.statusCheckRollup' is not null before attempting to access 'state'. This prevents the TypeError and provides a more informative message when 'commit.statusCheckRollup' is null.
@capthiron
Copy link
Contributor Author

capthiron commented Oct 20, 2023

After further investigation into the Github GraphQL API, I have discovered that the commit.statusCheckRollup field is indeed nullable. This means that there are valid scenarios where this field can be null. This could occur if the commit does not have any status checks associated with it.

Therefore these changes should at least help improving the robustness and reliability of the action when dealing with commits without associated status checks.

@GrantBirki GrantBirki merged commit efe4892 into github:main Nov 1, 2023
1 of 3 checks passed
@GrantBirki GrantBirki mentioned this pull request Nov 1, 2023
@capthiron capthiron deleted the fix/null-check-for-commit-status branch November 2, 2023 17:04
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.

2 participants