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

Upload yarn lock on failure #4

Merged
merged 1 commit into from Mar 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 25 additions & 0 deletions yarn/action.yml
Expand Up @@ -195,10 +195,35 @@ runs:
working-directory: ${{ inputs.working-directory }}

- name: Install Dependencies
id: install-dependencies
run: yarn install
shell: bash
working-directory: ${{ inputs.working-directory }}

- name: Regenerate yarn.lock on failure
if: ${{ failure() && steps.install-dependencies.conclusion == 'failure' }}
shell: bash
env:
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 regenerated yarn.lock on failure
if: ${{ failure() && steps.install-dependencies.conclusion == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.working-directory != '.' && format('{0}-', inputs.working-directory) || '' }}yarn.lock
path: ${{ inputs.working-directory }}/yarn.lock

- name: Build
run: ${{ inputs.yarn-build-command }}
shell: bash
Expand Down