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

Add runs-on field to Spotless Check step in CI #3400

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/CI-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
product: opensearch

spotless:
if: github.repository == 'opensearch-project/ml-commons'
Copy link
Contributor

Choose a reason for hiding this comment

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

Whats the significance of using if here?

I'm not too familiar with the CI workflow but cant we make it always run the latest?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This if condition forces the job (specifically the spotless step) to only run, if triggered in ml-commons repo. Essentially preventing it to run in any other repository.

For example in line 20 we have this:

    uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main
    with:
      product: opensearch

We are triggering a workflow file from opensearch-build team.
Had the openserach-build team put a condition in their workflow file to only run if the repo is opensearch-build, the Get-CI-Image-Tag step in our CI would have failed.

Having this check prevents accidental or unintended execution. (It does not effect the logic, just a good practice)

Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome thanks for sharing!

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Spotless requires JDK 17+
Expand Down
Loading