Skip to content

Commit

Permalink
feat: Scan readme files in java-yoshi-mono-repo strategy (#1853)
Browse files Browse the repository at this point in the history
* feat: Scan readme files in java-yoshi-mono-repo strategy

* chore: nothing

* chore: fixing tests

* chore: fixing lint

* chore: fixing tests
  • Loading branch information
ddixit14 authored Feb 15, 2023
1 parent b57b558 commit 635cc7d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/strategies/java-yoshi-mono-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ export class JavaYoshiMonoRepo extends Java {
this.targetBranch,
this.path
);
const readmeFilesSearch = this.github.findFilesByFilenameAndRef(
'README.md',
this.targetBranch,
this.path
);

const pomFiles = await pomFilesSearch;
pomFiles.forEach(path => {
Expand Down Expand Up @@ -165,6 +170,19 @@ export class JavaYoshiMonoRepo extends Java {
});
});

const readmeFiles = await readmeFilesSearch;
readmeFiles.forEach(path => {
updates.push({
path: this.addPath(path),
createIfMissing: false,
updater: new JavaUpdate({
version,
versionsMap,
isSnapshot: options.isSnapshot,
}),
});
});

this.extraFiles.forEach(extraFile => {
if (typeof extraFile === 'object') {
return;
Expand Down
10 changes: 10 additions & 0 deletions test/strategies/java-yoshi-mono-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ describe('JavaYoshiMonoRepo', () => {
findFilesStub
.withArgs('dependencies.properties', 'main', '.')
.resolves(['dependencies.properties']);
findFilesStub
.withArgs('README.md', 'main', '.')
.resolves(['path1/README.md', 'path2/README.md']);
const getFileContentsStub = sandbox.stub(
github,
'getFileContentsOnBranch'
Expand All @@ -255,6 +258,8 @@ describe('JavaYoshiMonoRepo', () => {
assertHasUpdate(updates, 'path1/build.gradle', JavaUpdate);
assertHasUpdate(updates, 'dependencies.properties', JavaUpdate);
assertHasUpdate(updates, 'versions.txt', VersionsManifest);
assertHasUpdate(updates, 'path1/README.md', JavaUpdate);
assertHasUpdate(updates, 'path2/README.md', JavaUpdate);
});

it('finds and updates extra files', async () => {
Expand Down Expand Up @@ -300,6 +305,9 @@ describe('JavaYoshiMonoRepo', () => {
findFilesStub
.withArgs('dependencies.properties', 'main', '.')
.resolves(['dependencies.properties']);
findFilesStub
.withArgs('README.md', 'main', '.')
.resolves(['path1/README.md', 'path2/README.md']);
const getFileContentsStub = sandbox.stub(
github,
'getFileContentsOnBranch'
Expand Down Expand Up @@ -327,6 +335,8 @@ describe('JavaYoshiMonoRepo', () => {
assertHasUpdate(updates, 'path1/build.gradle', JavaUpdate);
assertHasUpdate(updates, 'dependencies.properties', JavaUpdate);
assertHasUpdate(updates, 'versions.txt', VersionsManifest);
assertHasUpdate(updates, 'path1/README.md', JavaUpdate);
assertHasUpdate(updates, 'path2/README.md', JavaUpdate);
});

it('updates changelog.json', async () => {
Expand Down

0 comments on commit 635cc7d

Please sign in to comment.