Skip to content

Fix flaky mod definitions test #4892

Fix flaky mod definitions test

Fix flaky mod definitions test #4892

Workflow file for this run

name: PR
on: pull_request
jobs:
lockfile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: package-lock.json
- name: Detect changes
id: stats
run: |
git fetch origin ${{ github.base_ref }}
STAT="$(git diff --numstat origin/${{ github.base_ref }}..HEAD -- package-lock.json)"
DELETED=$(echo $STAT | cut -d " " -f 1)
ADDED=$(echo $STAT | cut -d " " -f 2)
TOTAL_CHANGES=$((DELETED + ADDED))
echo "STAT=$STAT"
echo "DELETED=$DELETED"
echo "ADDED=$ADDED"
echo "TOTAL_CHANGES=$TOTAL_CHANGES"
echo "changes=$TOTAL_CHANGES" >> $GITHUB_OUTPUT
- if: steps.stats.outputs.changes <= 1000
uses: marocchino/sticky-pull-request-comment@v2
with:
header: lockfile # Unique identifier for the comment
hide: true
- if: steps.stats.outputs.changes > 1000
uses: marocchino/sticky-pull-request-comment@v2
with:
header: lockfile # Unique identifier for the comment
recreate: true
message: |
## ⚠️ Large diff for package-lock.json
There are ${{ steps.stats.outputs.changes }} line changes in package-lock.json. This should not happen unless you're updating a lot of dependencies at once. Regenerating the lockfile should not be necessary.
If you're seeing Vercel deployment failures, this is likely the cause.
Run these commands to reset these changes:
```sh
git checkout origin/main -- package-lock.json
npm install
```
You might want to click on "Update branch" first so that the results are accurate.
- if: steps.stats.outputs.changes > 1000
run: exit 1
vendors:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get list of changed vendored files
id: changedfiles
uses: tj-actions/changed-files@v45
with:
files: "applications/browser-extension/src/vendors/**/*.*"
- name: Leave annotations
if: steps.changedfiles.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changedfiles.outputs.all_changed_files }}
run: |
for FILE in ${ALL_CHANGED_FILES}; do
echo "::warning file=$FILE,line=0::Vendored files should rarely change: https://github.com/pixiebrix/pixiebrix-extension/pull/7941"
done
exit 1 # Make the job fail for visibility https://github.com/pixiebrix/pixiebrix-extension/pull/7941#discussion_r1528517121