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: Return False if upstream codelist check fails in CI #229

Merged
merged 2 commits into from
Nov 13, 2023

Conversation

rebkwok
Copy link
Contributor

@rebkwok rebkwok commented Nov 13, 2023

Makes opensafely codelists check print the error and return False (but not exit with an error) when running in CI, to avoid failing the entire GH "test that the project is runnable" action for study repos.

except requests.exceptions.ConnectionError:
print(
f"Local codelists OK; could not contact {OPENCODELISTS_BASE_URL} for upstream check,"
"try again later"
)
return True

return upstream_check
Copy link
Contributor

Choose a reason for hiding this comment

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

I think returning False here will cause the entire command to exit with an error. See:

# allow functions to return True/False, or an explicit exit code
if success is False:
exit_code = 1
elif success is True:
exit_code = 0
else:
exit_code = success

Which I think is not the behaviour you wanted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it's not, thanks.

@rebkwok rebkwok merged commit 666fa9c into main Nov 13, 2023
6 checks passed
@rebkwok rebkwok deleted the codelists-check-in-ci branch November 13, 2023 17:38
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