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: skip unnecessary test runs for bot-generated and non-critical PRs #1339

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

AdityaP700
Copy link

@AdityaP700 AdityaP700 commented Jan 23, 2025

Description

Testing

  • Verified the solution by making minor changes in README.md and CODE_OF_CONDUCT.md and testing it by making a PR .
  • Confirmed that tests for Node versions 18 and 20 were successfully skipped as intended .

Copy link

changeset-bot bot commented Jan 23, 2025

⚠️ No Changeset found

Latest commit: 2f7eb4f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@AdityaP700
Copy link
Author

Hey @derberg ,done with the changes in the required file , do let me know of any further changes . Thanks

@AdityaP700 AdityaP700 changed the title Fix: skip unnecessary test runs for bot-generated and non-critical PRs fix: skip unnecessary test runs for bot-generated and non-critical PRs Jan 23, 2025
@AdityaP700 AdityaP700 changed the title fix: skip unnecessary test runs for bot-generated and non-critical PRs fix : skip unnecessary test runs for bot-generated and non-critical PRs Jan 23, 2025
@AdityaP700 AdityaP700 changed the title fix : skip unnecessary test runs for bot-generated and non-critical PRs fix: skip unnecessary test runs for bot-generated and non-critical PRs Jan 23, 2025
@ItshMoh
Copy link

ItshMoh commented Jan 25, 2025

LGTM :)

@ItshMoh
Copy link

ItshMoh commented Jan 25, 2025

Hey @derberg can you run the workflow.

Copy link
Contributor

@DhairyaMajmudar DhairyaMajmudar left a 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.

.github/workflows/pr-testing-with-test-project.yml Outdated Show resolved Hide resolved
Comment on lines 16 to 31
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
Copy link
Contributor

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

Copy link
Author

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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.

Copy link
Author

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 .

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.

Improve testing speed by skipping it for certain PRs
3 participants