-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 condtional checks on jobs to skip on document changes. #5438
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,25 @@ permissions: | |
contents: read | ||
|
||
jobs: | ||
conditional-changes: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: read | ||
outputs: | ||
doc: ${{ steps.filter.outputs.doc }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dorny/paths-filter@v2 | ||
id: filter | ||
with: | ||
filters: | | ||
doc: | ||
- 'site/**' | ||
|
||
lint: | ||
name: Lint | ||
needs: conditional-changes | ||
if: needs.conditional-changes.outputs.doc == 'false' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sarab97 So, I think it looks like this condition checks only whether There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As per my understanding of README from https://github.com/dorny/paths-filter. The condition will check for change and as per filter condition ensure the change is only in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://github.com/dorny/paths-filter?tab=readme-ov-file#outputs
Oh. Thanks I understand. |
||
runs-on: [ubuntu-latest] | ||
steps: | ||
- name: Check out code into the Go module directory | ||
|
@@ -30,6 +47,8 @@ jobs: | |
|
||
test-linux: | ||
name: Test Linux | ||
needs: conditional-changes | ||
if: needs.conditional-changes.outputs.doc == 'false' | ||
runs-on: [ubuntu-latest] | ||
steps: | ||
- name: Check out code into the Go module directory | ||
|
@@ -46,6 +65,8 @@ jobs: | |
|
||
test-macos: | ||
name: Test MacOS | ||
needs: conditional-changes | ||
if: needs.conditional-changes.outputs.doc == 'false' | ||
runs-on: [macos-latest] | ||
steps: | ||
- name: Check out code into the Go module directory | ||
|
@@ -62,6 +83,8 @@ jobs: | |
|
||
test-windows: | ||
name: Test Windows | ||
needs: conditional-changes | ||
if: needs.conditional-changes.outputs.doc == 'false' | ||
runs-on: [windows-latest] | ||
steps: | ||
- name: Check out code into the Go module directory | ||
|
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.
Thanks @sarab97 for the PR!
I suppose, we have to ignore:
I'm not sure what "Diff the API" means referred on the issue page, will ask further clarification on this and get back to you
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 have confirmed that we need to add the condition for this job as well
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.
Yes, I was looking through that and intentionally skipped that. As its single job in a different workflow so adding this condition would mean adding the same conditional job there too. And that will always run to check condition and then make decision to skip that single api diff job or not. I took judgement call to skip doing this there as incase of code changes we will be spending additional time and resources to the same workflow and incase of document changes a single job will run anyways crawling though the code. Im open to your suggestions and we surely can integrate it there as well.
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.
Im not sure adding
*_test.go
files falls under doc changes scope. However*md
file does make sense. I was thinking maybe we first stablize this then we can easily add any more conditions as per need."diif the api" refers to that apidiff 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.
Let's add the condition there in case apidiff workflow expands in the future. Or maybe we can make condition check job generic and can be referenced from these workflows, maybe we can use these strategies:
Ah you are right, I misunderstood the requirements, you don't need to ignore *_test after all. Speaking of detail of the check, does a code comment change counts as code change or docs change?
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.
The apidiff is a single action workflow having a job. A workflow has single purpose. So checking for api diff that wont be expanding.
I have looked though link you provided. Those do seem interesting approach but have their own drawbacks like rerunning it again for each call which will be inefficient in our case.
I would prefer keeping this simple rather than overcomplicating.
We dont need to go in so deep wondering about comment change. We wont be having any way to check that. And even if possible it would be too much of effort for too little of a reward.
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.
Okay, let's just make sure the condition cover
*.md
and.gitignore
for nowThere 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.
Yeah @antoooks I left it out to be done in future. But sure I will add both conditions.