Skip to content

Commit

Permalink
Ensure all asdf managed versions can be installed after updated by re…
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Nov 17, 2022
1 parent 038c8c8 commit 3a4ee69
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/ci-tool-versions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI - .tool-versions
on:
pull_request:
paths:
- '.tool-versions'
- '**/.tool-versions'

jobs:
installable:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- run: git fetch origin ${{ github.base_ref }} --depth=1
- name: Re-format only changed .tool-versions
id: format-only-new-versions
# Do not use `echo json=$(script)` syntax here. The script generates multilines.
run: |
tempfile="$(mktemp)"
echo -n 'json=' | tee --append "$tempfile"
git diff origin/${{ github.base_ref }} HEAD --word-diff --relative ./examples/.tool-versions | grep -F ']{+' | ruby -r json -e 'puts STDIN.each_line.map { |l| /\A(\S+\s+).*?\{\+([^\+]+)/.match(l).captures.join }.join("\n").to_json' | tee --append "$tempfile"
cat "$tempfile" | tee --append $GITHUB_OUTPUT
- uses: asdf-vm/actions/install@v1
with:
tool_versions: '${{ fromJson(steps.format-only-new-versions.outputs.json) }}'

0 comments on commit 3a4ee69

Please sign in to comment.