mirror of
https://github.com/actions/setup-java.git
synced 2025-04-21 10:26:46 +00:00
fix: throw error in case of no package manager file found
This commit is contained in:
parent
33dfe174e3
commit
67b74a15de
4 changed files with 7 additions and 12 deletions
|
@ -65,9 +65,8 @@ describe('dependency cache', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('for maven', () => {
|
describe('for maven', () => {
|
||||||
it('warns if no pom.xml found', async () => {
|
it('throws error if no pom.xml found', async () => {
|
||||||
await restore('maven');
|
await expect(restore('maven')).rejects.toThrowError(
|
||||||
expect(spyWarning).toBeCalledWith(
|
|
||||||
`No file in ${projectRoot(
|
`No file in ${projectRoot(
|
||||||
workspace
|
workspace
|
||||||
)} matched to [**/pom.xml], make sure you have checked out the target repository`
|
)} matched to [**/pom.xml], make sure you have checked out the target repository`
|
||||||
|
@ -83,9 +82,8 @@ describe('dependency cache', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('for gradle', () => {
|
describe('for gradle', () => {
|
||||||
it('warns if no build.gradle found', async () => {
|
it('throws error if no build.gradle found', async () => {
|
||||||
await restore('gradle');
|
await expect(restore('gradle')).rejects.toThrowError(
|
||||||
expect(spyWarning).toBeCalledWith(
|
|
||||||
`No file in ${projectRoot(
|
`No file in ${projectRoot(
|
||||||
workspace
|
workspace
|
||||||
)} matched to [**/*.gradle*,**/gradle-wrapper.properties], make sure you have checked out the target repository`
|
)} matched to [**/*.gradle*,**/gradle-wrapper.properties], make sure you have checked out the target repository`
|
||||||
|
|
3
dist/cleanup/index.js
vendored
3
dist/cleanup/index.js
vendored
|
@ -64589,8 +64589,7 @@ function restore(id) {
|
||||||
core.debug(`primary key is ${primaryKey}`);
|
core.debug(`primary key is ${primaryKey}`);
|
||||||
core.saveState(STATE_CACHE_PRIMARY_KEY, primaryKey);
|
core.saveState(STATE_CACHE_PRIMARY_KEY, primaryKey);
|
||||||
if (primaryKey.endsWith('-')) {
|
if (primaryKey.endsWith('-')) {
|
||||||
core.warning(`No file in ${process.cwd()} matched to [${packageManager.pattern}], make sure you have checked out the target repository`);
|
throw new Error(`No file in ${process.cwd()} matched to [${packageManager.pattern}], make sure you have checked out the target repository`);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
const matchedKey = yield cache.restoreCache(packageManager.path, primaryKey, [
|
const matchedKey = yield cache.restoreCache(packageManager.path, primaryKey, [
|
||||||
`${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${id}`
|
`${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${id}`
|
||||||
|
|
3
dist/setup/index.js
vendored
3
dist/setup/index.js
vendored
|
@ -18976,8 +18976,7 @@ function restore(id) {
|
||||||
core.debug(`primary key is ${primaryKey}`);
|
core.debug(`primary key is ${primaryKey}`);
|
||||||
core.saveState(STATE_CACHE_PRIMARY_KEY, primaryKey);
|
core.saveState(STATE_CACHE_PRIMARY_KEY, primaryKey);
|
||||||
if (primaryKey.endsWith('-')) {
|
if (primaryKey.endsWith('-')) {
|
||||||
core.warning(`No file in ${process.cwd()} matched to [${packageManager.pattern}], make sure you have checked out the target repository`);
|
throw new Error(`No file in ${process.cwd()} matched to [${packageManager.pattern}], make sure you have checked out the target repository`);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
const matchedKey = yield cache.restoreCache(packageManager.path, primaryKey, [
|
const matchedKey = yield cache.restoreCache(packageManager.path, primaryKey, [
|
||||||
`${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${id}`
|
`${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${id}`
|
||||||
|
|
|
@ -65,12 +65,11 @@ export async function restore(id: string) {
|
||||||
core.debug(`primary key is ${primaryKey}`);
|
core.debug(`primary key is ${primaryKey}`);
|
||||||
core.saveState(STATE_CACHE_PRIMARY_KEY, primaryKey);
|
core.saveState(STATE_CACHE_PRIMARY_KEY, primaryKey);
|
||||||
if (primaryKey.endsWith('-')) {
|
if (primaryKey.endsWith('-')) {
|
||||||
core.warning(
|
throw new Error(
|
||||||
`No file in ${process.cwd()} matched to [${
|
`No file in ${process.cwd()} matched to [${
|
||||||
packageManager.pattern
|
packageManager.pattern
|
||||||
}], make sure you have checked out the target repository`
|
}], make sure you have checked out the target repository`
|
||||||
);
|
);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const matchedKey = await cache.restoreCache(packageManager.path, primaryKey, [
|
const matchedKey = await cache.restoreCache(packageManager.path, primaryKey, [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue