Setup-java can not find file

I have a composite action and I am executing the following script

url=$(curl -I -s https://api.sdkman.io/2/broker/download/$candidate/$version/$platform_param | grep location: | awk {'print $2'})
output=$(echo $url | cut -d/ -f4-)
filename=$(basename -- $output)
curl -L -o $filename https://api.sdkman.io/2/broker/download/$candidate/$version/$platform_param

echo "::set-output name=file::$GITHUB_WORKSPACE/$filename"

Workflow configuration is:

- name: Setup Java ${{ matrix.version }}
      id: sdkman
      uses: ./
      with:
        candidate: java
        version: ${{ matrix.version }}
    - uses: actions/setup-java@v1
      id: setup-java
      with:
        java-version: 15.0.0
        jdkFile: ${{ steps.sdkman.outputs.file }}

However, it works for windows but not for macos or ubuntu. Previously, it was working with the other oss but no windows, I made some changes which will allow to make it work with windows but now I am getting no such file or directory, stat '/Users/runner/work/sdkman-action/sdkman-action/OpenJDK15U-jdk_x64_mac_hotspot_15_36.tar.gz' for macos and ubuntu Build Example

Doing a pwd and ls and I can see that the file is in that path.

@eddumelendez,

After executing your action, you can set up a extra step like as below to check if the downloaded files during your action execution are retained.

- name: Setup Java ${{ matrix.version }}
      id: sdkman
      uses: ./
      with:
        candidate: java
        version: ${{ matrix.version }}

- name: List files
  shell: bash
  run: ls -R

If the downloaded files during your action execution cab be listed, there may be some issue on “actions/setup-java”. If so, I recommend that you can look for an existing topic or start a new one on the Issues tab of this action repository (here) to report the problem to the appropriate engineering team for further investigation and evaluation.

Thanks @brightran! indeed the file is listed. Example

Issue: https://github.com/actions/setup-java/issues/110

1 Like

@eddumelendez,

Looks like, the issue indeed occurs on the setup-java action.
According to the description of the input parameter “jdkFile” (see here),

Path to where the compressed JDK is located. The path could be in your source repository or a local path on the agent.

Specifying the files in the directory of source repository is not the problem.
About the supported types of the compressed file, there also is no any limitations statement in the README of the action.