Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: update dependency @mdn/browser-compat-data to v6.0.32 #2277

chore: update dependency @mdn/browser-compat-data to v6.0.32

chore: update dependency @mdn/browser-compat-data to v6.0.32 #2277

# This workflow is used to augment the capabilities of the renovate GitHub app by updating the
# e2e test snapshots when certain dependencies are updated.
name: Renovate Update E2E Snapshots
on:
pull_request:
branches: [main]
paths:
- 'package.json'
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true
jobs:
maybe_update_e2e_tests:
# Only run if it was the renovate bot that triggered the workflow (otherwise we'll create a loop)
if: contains('["renovate[bot]"]', github.actor) == true
name: Update if required
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# To allow us to perform the git diff we need the git history
fetch-depth: 0
# To ensure we can push from a different user (and therefore cause actions to rerun)
persist-credentials: false
- name: Check if any relevant package was changed as part of the latest commit by renovate bot on the PR
id: relevant-packages-check
run: |
declare -a packages=(
"eslint"
"@typescript-eslint/rule-tester"
)
for package in "${packages[@]}"
do
# It's important we have the leading and trailing (escaped) " here so we know it is an exact match of the package name
git diff HEAD~1 -G"\"$package\"" --exit-code package.json && echo "$package unchanged" || echo "::set-output name=was-changed::true"
done
- uses: pnpm/action-setup@v4
if: ${{ steps.relevant-packages-check.outputs.was-changed == 'true' }}
name: Install pnpm
with:
run_install: false
- name: Install Node.js per package.json
if: ${{ steps.relevant-packages-check.outputs.was-changed == 'true' }}
uses: actions/setup-node@v4
with:
# Use the volta.node property as the source of truth
node-version-file: 'package.json'
- name: Update e2e snapshots if any relevant package was changed and commit the updated snapshots
if: ${{ steps.relevant-packages-check.outputs.was-changed == 'true' }}
env:
# We cannot use secrets.GITHUB_TOKEN for this because it is not permitted to kick off subsequent actions worfklow runs, so we use a PAT instead
GITHUB_TOKEN: ${{ secrets.JAMES_HENRY_GITHUB_TOKEN }}
run: |
# Checkout the PR branch using the github CLI
gh pr checkout ${{ github.event.pull_request.number }}
pnpm install --ignore-scripts
pnpm build
# Update the e2e test snapshots
pnpm update-e2e-snapshots --skip-nx-cache
# Ensure all the changed files are formatted appropriately
pnpm format
# Commit all snapshot changes to the PR (see note on not being able to use secrets.GITHUB_TOKEN for this)
git config --global user.email "[email protected]"
git config --global user.name "JamesHenry"
git remote set-url origin https://x-access-token:[email protected]/$GITHUB_REPOSITORY.git
# Only add snapshot files (other files may have been altered by the update, but we don't want to commit them)
git add e2e/src/**/*.snap
git commit -m "chore: update e2e test snapshots"
git push