jdx / mise

dev tools, env vars, task runner
https://mise.jdx.dev
MIT License
8.11k stars 214 forks source link

chore: eliminate .tool-versions only used for jq #2195

Closed donaldguy closed 1 month ago

donaldguy commented 1 month ago

Pretty self-explanatory.

After an initial clone, I thought it was odd that I got:

$ mise ls --current
Plugin                Version   Config Source                             Requested
actionlint            1.7.0     ~/Code/github.com/jdx/mise/.mise.toml     latest
cargo:cargo-edit      0.12.2    ~/Code/github.com/jdx/mise/.mise.toml     latest
cargo:cargo-show      0.6.0     ~/Code/github.com/jdx/mise/.mise.toml     latest
cargo:git-cliff       2.2.2     ~/Code/github.com/jdx/mise/.mise.toml     latest
direnv                2.34.0    ~/Code/github.com/jdx/mise/.mise.toml     latest
jq                    1.7.1     ~/Code/github.com/jdx/mise/.tool-versions latest
npm:markdownlint-cli  0.38.0    ~/Code/github.com/jdx/mise/.mise.toml     0.38
npm:prettier          3.2.5     ~/Code/github.com/jdx/mise/.mise.toml     3
python                3.12.3    ~/Code/github.com/jdx/mise/.mise.toml     latest
ruby                  3.3.1     ~/.config/mise/config.toml                3.3.1
shellcheck            0.10.0    ~/Code/github.com/jdx/mise/.mise.toml     0.10
shfmt                 3.8.0     ~/Code/github.com/jdx/mise/.mise.toml     3
tiny                  1.1.0     ~/Code/github.com/jdx/mise/.mise.toml     1
usage                 0.2.1     ~/.config/mise/config.toml                latest

so I removed the (main) outlier [it also seems odd and possibly like a bug that globals are included in a --current output (because this is a child of my home directory?) but that's for another issue or PR]

donaldguy commented 1 month ago

There definitely might be some virtue (separate from the current only-used-for-jq state) in displaying .tool-versions compatibility in this repo

(both as a type of "living documentation" and in principle making mise not, as a matter of requirement, self-hosting)

but if so that would probably be best handled by a GitHub action to the effect of [i.e. I wrote but didn't test in any way]

name: update-tool-versions
on:
  pull_request_target:
    types:
      - opened
      - edited
      - synchronize
    paths:
      - ".mise.toml"

permissions:
  contents: read
  pull-requests: write

jobs:
  check-if-tools-changed:
    runs-on: ubuntu-22.04
    steps:
      # for speed I'd think you'd want (both here and by the by e.g.
      # at github.com/jdx/mise/blob/23db39/.github/workflows/test-plugins.yml#L22-L38 in many cases)
       - uses: jdx/mise-action@v2
         with: { install: false }
       - uses: actions/checkout@v4
         with:
           repository: ${{ github.event.pull_request.head.repo.full_name }}
           ref: ${{ github.event.pull_request.head.ref }}
           token: ${{ secrets.RTX_GITHUB_BOT_TOKEN || github.token }}
       - run: "mise current > .tool-versions"
       - run: "git diff --quiet -- .tool-versions"
       - if: ${{ failure() }}
         uses: parkerbxyz/suggest-changes@v1
         with:
           comment: "Please keep .tool-versions in sync with .mise.toml as follows"

or a more aggressive version if you are inclined to give the job contents: write (and/or silently handle it at merge time)

donaldguy commented 1 month ago

As to the above, mise current currently: