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

github check created after loading ruleset #643

Merged
merged 1 commit into from
Jun 7, 2022
Merged

Conversation

kaylachun
Copy link
Contributor

@kaylachun kaylachun commented Jun 6, 2022

Motivation and Context

Fix regression of this: https://github.com/stoplightio/spectral-action/issues/506
Github check Lint(push) remains in progress until it times out.

#640

Description

Lint(push) would get stuck if there was an error thrown in createSpectral(), more specifically getRuleset().
If there were no rulesets found in the repo, an error was thrown in getRuleset() but that didn't cause the Lint(push) check to fail. Instead the check would hang because it wasn't able to continue to the next step (updateGithubCheck()).
I changed the github check to be created after finding and loading a ruleset. If there were any errors thrown in that process, the github check never gets created. If there is a valid ruleset, the check is created and the linting happens as usual.
If there is an error thrown while loading the ruleset, the Run Spectral actions fails with the correct error message.

How Has This Been Tested?

I tested this on a private repo and followed the testing steps in #506. I've tested it with no rulesets in the repo, a ruleset that would return an error after linting, and a ruleset that returned a warning after linting.
All had expected behaviors of failing/succeeding when supposed to (and never hanging).

Screenshot(s)/recordings(s)

What happens now when an error is thrown while loading the Spectral ruleset:
image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

@kaylachun kaylachun marked this pull request as ready for review June 6, 2022 22:12
@kaylachun kaylachun requested review from a team and jasonmgillhub and removed request for a team June 6, 2022 22:17
Copy link

@jasonmgillhub jasonmgillhub left a comment

Choose a reason for hiding this comment

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

Sounds like quite the pain of a task, but good work on figuring out a solution. Code change looks good to me!

@kaylachun kaylachun merged commit 6018583 into master Jun 7, 2022
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