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

feat(get-changed-files): include original location for renamed files in response #674

Merged
merged 4 commits into from
Dec 3, 2024

Conversation

aschwenn
Copy link
Contributor

@aschwenn aschwenn commented Dec 3, 2024

📝 Description

when files are renamed with no changes, github doesn't treat the change as an addition + a deletion, it treats it as one singular renamed object. this isn't the most helpful in a monorepo setting, where we may have a file moved (renamed) from one package to another, in which case we'd want to test both packages, not just the one the file was moved into.

this change pulls in all previous_filename fields on files that have been renamed to append to the full list. that object coming back from the GH API/octokit looks like:

{
    "sha": "dcc78ba",
    "filename": "new/file/location/file.js",
    "status": "renamed",
    "additions": 4,
    "deletions": 6,
    "changes": 10,
    "blob_url": "https://github.com/...",
    "raw_url": "https://github.com/...",
    "contents_url": "https://api.github.com/repos/...",
    "patch": "...",
    "previous_filename": "previous/file/location/file.js"
  },

to test: i've added a case to the test file to account for this 🙂

@aschwenn aschwenn requested a review from a team as a code owner December 3, 2024 19:34
test/helpers/get-changed-files.test.ts Outdated Show resolved Hide resolved
src/utils/get-changed-filepaths.ts Outdated Show resolved Hide resolved
@aschwenn aschwenn force-pushed the get-changed-files-include-renamed-original-location branch from 5ba68d9 to 699dec4 Compare December 3, 2024 20:51
@aschwenn aschwenn merged commit a417444 into main Dec 3, 2024
7 checks passed
@aschwenn aschwenn deleted the get-changed-files-include-renamed-original-location branch December 3, 2024 21:15
@eg-oss-ci
Copy link

🎉 This PR is included in version 1.66.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants