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

Allow asdf-vm/actions/install (to pass) without .tool-versions file #562

Open
MPV opened this issue Sep 6, 2023 · 1 comment
Open

Allow asdf-vm/actions/install (to pass) without .tool-versions file #562

MPV opened this issue Sep 6, 2023 · 1 comment

Comments

@MPV
Copy link

MPV commented Sep 6, 2023

Why does this action fail is there isn't any .tool-versions file?
That's' not how asdf install behaves on my local computer.
There it falls back to check in my home directory for ~/.tool-versions (which this action doesn't seem to do?).
And even then if it isn't there, it doesn't fail, right?

I'd like to use this for a reusable workflow in my organization, where we can "install things from asdf if the repository is using a .tool-versions file, otherwise not".

Today, running this action without a .tool-versions file in the current directory, the action fails with:
Action failed with error Error: ENOENT: no such file or directory, open '.tool-versions'

@MPV
Copy link
Author

MPV commented Sep 22, 2023

Workaround no 1:

  steps:
    - name: Detect ASDF .tool-versions file in repo
      shell: bash
      id: detect_tool_versions_file
      run: |
        if [ -s .tool-versions ]; then
         echo "exists=1" >> $GITHUB_OUTPUT
        fi

    - name: ASDF install tools
      if: ${{ steps.detect_tool_versions_file.outputs.exists == '1' }}
      uses: asdf-vm/actions/install@6a442392015fbbdd8b48696d41e0051b2698b2e4 # v2

Workaround no 2:

  steps:
    - name: ASDF install tools
      uses: asdf-vm/actions/install@6a442392015fbbdd8b48696d41e0051b2698b2e4 # v2
      continue-on-error: true

That said, maybe the UX is cleaner if this action could support (possibly opting in to) "being green" even when a .tool-versions file is missing.

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

No branches or pull requests

1 participant