-
Notifications
You must be signed in to change notification settings - Fork 85
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 handling of shallow clones when checking for change files #780
Conversation
106564f
to
8ebf412
Compare
src/changefile/getChangedPackages.ts
Outdated
// Fetch more history (if needed, this could be optimized later to only deepen by e.g. 100 commits at a time) | ||
try { | ||
console.log('This is a shallow clone. Unshallowing to check for changes...'); | ||
git(['fetch', '--unshallow'], { cwd, throwOnError: 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.
Can you confirm this "throwOnError" flag? I can't find doc for it: https://nodejs.org/api/child_process.html#child_processspawnsynccommand-args-options
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.
Ah it's added in microsoft/workspace-tools#193 which isn't actually merged yet (I was testing this branch against a tgz of those changes at first)
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 got rid of the part that required the workspace-tools update
f8ce0cc
to
ae98556
Compare
# Pull Request ## 🤨 Rationale - Updated `fetch-depth: 0` comment from being [needed by beachball](microsoft/beachball#780) to being [needed by chromatic](https://github.com/ni/nimble/actions/runs/8164295790/job/22319288123#step:14:50). - Updated renovate to make a single PR for npm updates that we can let update to latest. - Angular and it's related packages are ignored - `^@angular`, `ng-packagr`, `zone.js`, `typescript` - Pinned packages are ignored - `@microsoft/fast-foundation` and `@microsoft/fast-react-wrapper` due to [fast issue](microsoft/fast#6906) - `comlink` as it is partially vendored into workers and needs a controlled and pinned update - `remark-gfm` as [updating breaks mdx](storybookjs/storybook#24743 (comment)) - Removed npm version specific install that was now downgrading the npm version accidentally. - Removed file permission workaround [no longer needed to prevent warnings](actions/upload-pages-artifact#45). - Updated the beachball patch-package ## 👩💻 Implementation See above. ## 🧪 Testing Relying on CI. ## ✅ Checklist - [x] I have updated the project documentation to reflect my changes or determined no changes are needed.
By default, github
actions/checkout
only fetches the current merge ref of the PR (no history and no other branches). This causes problems forbeachball check
, because it doesn't have all the history that it needs to compare against.These problems have existed for quite some time, in any repo using
actions/checkout
> v1 withoutfetch-depth: 0
. And theworkspace-tools
git changed files helpers were hiding the issue by returning empty arrays if git commands failed.Fix is to add explicit checks on the beachball side for various conditions related to missing history. If history is missing and fetching is enabled, it will fetch the extra history. If fetching is disabled, it will print informative error messages.
(You can see that it works because this PR's initial build includes the log about unshallowing, and ultimately failed due to a missing change file!)