actions / setup-java

Set up your GitHub Actions workflow with a specific version of Java
MIT License
1.55k stars 742 forks source link

The cached folder must be parameterized to allow user inputs #680

Open lucasoares opened 2 months ago

lucasoares commented 2 months ago

Description:

Currently my team uses a different M2 repository path for Maven for some specific reasons.

The current implementation of the action have the paths hardcoded and can't be changed with an input:


const supportedPackageManager: PackageManager[] = [
  {
    id: 'maven',
    path: [join(os.homedir(), '.m2', 'repository')],
    // https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---maven
    pattern: ['**/pom.xml']
  },
  {
    id: 'gradle',
    path: [
      join(os.homedir(), '.gradle', 'caches'),
      join(os.homedir(), '.gradle', 'wrapper')
    ],
    // https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---gradle
    pattern: [
      '**/*.gradle*',
      '**/gradle-wrapper.properties',
      'buildSrc/**/Versions.kt',
      'buildSrc/**/Dependencies.kt',
      'gradle/*.versions.toml',
      '**/versions.properties'
    ]
  },
  {
    id: 'sbt',
    path: [
      join(os.homedir(), '.ivy2', 'cache'),
      join(os.homedir(), '.sbt'),
      getCoursierCachePath(),
      // Some files should not be cached to avoid resolution problems.
      // In particular the resolution of snapshots (ideological gap between maven/ivy).
      '!' + join(os.homedir(), '.sbt', '*.lock'),
      '!' + join(os.homedir(), '**', 'ivydata-*.properties')
    ],
    pattern: [
      '**/*.sbt',
      '**/project/build.properties',
      '**/project/**.scala',
      '**/project/**.sbt'
    ]
  }
];

Justification: Allow user to adapt to its own environment.

Are you willing to submit a PR? Yes!

Should the input be a list? How the list will be added to the input parameter? It will be one parameter for each cache type or a single parameter to override the default path list?

gowridurgad commented 2 months ago

Hello @lucasoares , Thank you for this feature request. We will investigate it and get back to you as soon as we have some feedback.