jpmcb / prow-github-actions

Slash commands, jobs, and chat-ops for Github actions inspired by Kubernetes Prow ⚓️
MIT License
92 stars 10 forks source link

[maintainers] Tests are broken in GitHub actions #54

Closed jpmcb closed 2 years ago

jpmcb commented 2 years ago

Describe the bug Tests seem to be broken in this repos GitHub actions. This has actually been a long standing problem I haven't had a ton of time to dive into. Let's see if we can get the tests to run in GitHub actions so that we have a good signal for contributors.

To Reproduce

Notice that tests aren't working in contributor PRs: https://github.com/jpmcb/prow-github-actions/pull/51 or in bot PRs: https://github.com/jpmcb/prow-github-actions/pull/50

Expected behavior Tests to run successfully without error if tests are corrects

carolynvs commented 2 years ago

I am seeing this error intermittently on my local machine too, and then rerunning the tests sometimes would result in that flake passing. It's not reproducing tonight though.

I could submit a PR with some extra try/catch and debug statements around the call to cp.execSync and when that test fails in CI, hopefully it will point to what is going wrong.

https://stackoverflow.com/a/62151340

jpmcb commented 2 years ago

That's a great idea - let's start there! 👏🏼

carolynvs commented 2 years ago

I figured it out! That test relies on the current GitHub event name, and that is populated via the environment variable GITHUB_EVENT_NAME.

When you run locally, that's unset.

When you run the workflow in the context of the push, it's set to push, which isn't handled by main.ts, so it hits the default case and returns "not yet supported".

But when the workflow is run in a PR, that env var is set to "pull_request" which is an event that main tries to handle, and so it fails in a different spot because the test is missing all of the normal setup to actually run the prow github action's logic.

I'll have a PR to fix the test shortly.

jpmcb commented 2 years ago

Oh wow!!!! Great investigation! Yes, let's get that fix in asap! 👏🏼 👏🏼 👏🏼 👏🏼