-
-
Notifications
You must be signed in to change notification settings - Fork 248
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: skip unnecessary test runs for bot-generated and non-critical PRs #1339
base: master
Are you sure you want to change the base?
Conversation
Fix/skip unnecessary tests
docs: update README.md for testing
Update pr-testing-with-test-project.yml
Update pr-testing-with-test-project.yml
|
Hey @derberg ,done with the changes in the required file , do let me know of any further changes . Thanks |
LGTM :) |
Hey @derberg can you run the workflow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing PR @AdityaP700 just few suggestions to improve it more.
should-test: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
run_tests: ${{ steps.check.outputs.run_tests }} | ||
steps: | ||
- name: Check if tests should run | ||
id: check | ||
run: | | ||
# Skip for bot PRs with specific titles | ||
if [[ "${{ github.actor }}" == "asyncapi-bot" && "${{ github.event.pull_request.title }}" =~ ^(ci:\ update|chore\(release\):) ]] || \ | ||
[[ "${{ github.actor }}" == "allcontributors[bot]" && "${{ github.event.pull_request.title }}" =~ ^docs: ]]; then | ||
echo "run_tests=false" >> $GITHUB_OUTPUT | ||
else | ||
echo "run_tests=true" >> $GITHUB_OUTPUT | ||
fi | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a new job on which the actual job to be done is dependent won't increase job setup time?
Instead, how's about adding an if clause just like it is done here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did tried adding but thought of optimising it a bit thus made it likewise ,anyway will look into it .
test: | ||
if: github.event.pull_request.draft == false | ||
needs: should-test | ||
if: needs.should-test.outputs.run_tests == 'true' && github.event.pull_request.draft == false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if: needs.should-test.outputs.run_tests == 'true' && github.event.pull_request.draft == false | |
if: needs.should-test.outputs.run_tests == true && github.event.pull_request.draft == false |
wrapping true
in single quotes makes it string, although eventually, it results in a true statement (as strings are also considered to be true) so the workflow works as expected. But it's a good practice to use Booleans for truthy and falsy statements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright got it !! i took the assumptions so did such changes but anyway will resolve it .
Quality Gate passedIssues Measures |
Description
Related Issue(s)
Fixes Improve testing speed by skipping it for certain PRs #1335
Testing