From 846f8f49ebc1a76a989483bf56f3d81eb55b4157 Mon Sep 17 00:00:00 2001 From: Zimo Li <7163127+lzm0@users.noreply.github.com> Date: Tue, 12 Mar 2024 13:51:40 -0400 Subject: [PATCH] Upload regenerated yarn.lock on failure --- yarn/action.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/yarn/action.yml b/yarn/action.yml index 87c94db..422e6a8 100644 --- a/yarn/action.yml +++ b/yarn/action.yml @@ -204,15 +204,24 @@ runs: if: ${{ failure() && steps.install-dependencies.conclusion == 'failure' }} shell: bash env: - CI: 0 - run: yarn install + YARN_CHECKSUM_BEHAVIOR: update + run: | + yarn install + ( + echo '# Bad `yarn.lock`' + echo '## Bad local cache' + echo 'This could be caused by bad locally cached packages.' + echo 'Try running: [`yarn cache clean --all`](https://yarnpkg.com/cli/cache/clean#options)' + echo '## Generated `yarn.lock` file' + echo 'You can retrieve the `yarn.lock` file from artifacts (above)' + ) >> "$GITHUB_STEP_SUMMARY" working-directory: ${{ inputs.working-directory }} - - name: Upload yarn.lock on failure + - name: Upload regenerated yarn.lock on failure if: ${{ failure() && steps.install-dependencies.conclusion == 'failure' }} uses: actions/upload-artifact@v4 with: - name: yarn-lock-${{ inputs.working-directory }} + name: ${{ inputs.working-directory != '.' && format('{0}-', inputs.working-directory) || '' }}yarn.lock path: ${{ inputs.working-directory }}/yarn.lock - name: Build