-
Notifications
You must be signed in to change notification settings - Fork 725
update workflow for md changes only #3042
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
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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.
This approach will cause the whole workflow to fail if any unit tests fail OR are cancelled. The cancellations only happen when tests are skipped because no code changed, which means all .md PRs would immediately fail.
The underlying blocker is that docs-only PRs cause unit tests to be skipped entirely (this was done to save time and compute resources), but branch rules require unit tests on all PRs and there's no easy way to change that rule to only apply sometimes. So, a better approach would be to update test and test-bun jobs to always run, but have their Unit test step check paths-filter and exit 0 if it's false, causing the test jobs to succeed without running the tests.
|
Thanks for the feedback @JoshMock! Your approach is a better solution and i've updated the workflow accordingly. To validate my understanding, and from what I understood... jobs with false |
|
Ahh good catch. I forgot "skipped" and "cancelled" were different. |
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 think if we just tweak these two bits, we'll be good to go.
.github/workflows/nodejs.yml
Outdated
| if: needs.paths-filter.outputs.src-only == 'true' | ||
| run: | | ||
| npm run test:unit |
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.paths-filter.outputs.src-only == 'true' | |
| run: | | |
| npm run test:unit | |
| env: | |
| CODE_CHANGED: ${{needs.paths-filter.outputs.src-only}} | |
| run: | | |
| [ "$CODE_CHANGED" = "true" ] && npm run test:unit || exit 0 |
This is the step that branch rules require to run. An if condition will skip it (I think). Using an environment variable ensures it always runs, and will just exit early if src-only isn't true.
.github/workflows/nodejs.yml
Outdated
| bun run lint | ||
| - name: Unit test | ||
| if: needs.paths-filter.outputs.src-only == 'true' |
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.
Same 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.
perfect! hopefully this quiets some noise 🤞
Update workflow file to prevent stuck/hanging pipelines for
.mdonly prs.as we saw here: #3041 (comment)