Gradle version not working with provided version in wrapper.properties

I am trying to build kotlin code using gradle in github workflow
However in the gradle build it takes the version of gradle as 9.0 even though i have specified the gradle version on gradle-wrapper.properties as
distributionUrl=https://services.gradle.org/distributions/gradle-8.7-bin.zip

Error:-
6 tests completed, 2 failed

> Task :app:testDebugUnitTest FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

How does your workflow file look like / how do you execute Gradle?