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

ci: skip unnecessary test runs for bot-generated and non-critical PRs #1339

Merged
merged 20 commits into from
Jan 29, 2025

Conversation

AdityaP700
Copy link
Contributor

@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: c3fc681

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
Contributor 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.

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
Contributor 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
Contributor 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 .

README.md Outdated Show resolved Hide resolved
Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

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

lgtm
thanks a lot and also good proactive idea with paths filtering 👍🏼

@derberg derberg changed the title fix: skip unnecessary test runs for bot-generated and non-critical PRs ci: skip unnecessary test runs for bot-generated and non-critical PRs Jan 29, 2025
@derberg
Copy link
Member

derberg commented Jan 29, 2025

I adjusted the PR title with ci prefix, and fix indicates a patch release need - but now in CI setup editing case

@derberg
Copy link
Member

derberg commented Jan 29, 2025

/rtm

@asyncapi-bot asyncapi-bot merged commit ee36155 into asyncapi:master Jan 29, 2025
16 checks passed
@derberg
Copy link
Member

derberg commented Jan 29, 2025

@all-contributors please add @AdityaP700 for infra

Copy link
Contributor

@derberg

I've put up a pull request to add @AdityaP700! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Improve testing speed by skipping it for certain PRs
5 participants