diff --git a/action.yaml b/action.yaml index 7c6e894..934d1e8 100644 --- a/action.yaml +++ b/action.yaml @@ -23,18 +23,22 @@ outputs: runs: using: "composite" steps: + - name: Install outdated tool + shell: bash + run: | + yarn global add check-outdated --preferred-cache-folder ${{ inputs.yarn-cache }} + echo "$(yarn global bin)" >> $GITHUB_PATH + - name: Install dependencies shell: bash run: yarn install --no-progress --preferred-cache-folder ${{ inputs.yarn-cache }} --cwd ${{ inputs.working-dir }} - name: Check pre update outdated shell: bash - id: get-pre-update-outdated run: | set +e - outdated=$( ! yarn outdated --preferred-cache-folder ${{ inputs.yarn-cache }} --cwd ${{ inputs.working-dir }} | sed '1,6d; $d') - outdated="${outdated//$'\n'/'\n'}" - echo "::set-output name=outdated::$outdated" + cd ${{ inputs.working-dir }} + $( ! $(yarn global bin)/check-outdated --depth 1000 --ignore-dev-dependencies --columns name,current,latest,changes > ${{ runner.temp }}/pre-update ) - name: Upgrade dependencies shell: bash @@ -45,15 +49,18 @@ runs: id: get-post-update-outdated run: | set +e - outdated=$( ! yarn outdated --preferred-cache-folder ${{ inputs.yarn-cache }} --cwd ${{ inputs.working-dir }} | sed '1,6d; $d') - outdated="${outdated//$'\n'/'\n'}" - echo "::set-output name=outdated::$outdated" + cd ${{ inputs.working-dir }} + $( ! $(yarn global bin)/check-outdated --depth 1000 --ignore-dev-dependencies --columns name,current,latest,changes > ${{ runner.temp }}/post-update ) + echo "::set-output name=outdated::$(cat ${{ runner.temp }}/post-update)" - name: Make diff shell: bash id: get-diff + # strip ansi colors and fix line breaks run: | - diff=$(comm <(echo "${{ steps.get-pre-update-outdated.outputs.outdated }}") <(echo "${{ steps.get-post-update-outdated.outputs.unformatted-outdated }}") -23) + pre=$(cat ${{ runner.temp }}/pre-update | sed '1,5d' | head -n -6 | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g" | sed -r "s/\\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g" ) + post=$(cat ${{ runner.temp }}/post-update | sed '1,5d' | head -n -6 | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g" | sed -r "s/\\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g" ) + diff=$(comm <(echo "$pre") <(echo "$post") -23) diff="${diff//'%'/'%25'}" diff="${diff//$'\n'/'%0A'}" diff="${diff//$'\r'/'%0D'}"