chore: update dependency lint-staged to v15.2.7 #878
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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/parser" | |
) | |
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 | |
- 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 }} | |
yarn --ignore-scripts | |
yarn build | |
# Update the e2e test snapshots | |
yarn update-e2e-snapshots --skip-nx-cache | |
# Ensure all the changed files are formatted appropriately | |
yarn 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 "james@henry.sc" | |
git config --global user.name "JamesHenry" | |
git remote set-url origin https://x-access-token:$GITHUB_TOKEN@github.com/$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 |