Bump actions/setup-node from 4.0.3 to 4.0.4 #2440
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
name: Update Vitest Snapshots | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
update-snapshots: | |
runs-on: ubuntu-latest | |
if: startsWith(github.event.comment.body, '/update-snapshot') | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
ref: ${{ github.event.issue.head_ref }} | |
repository: ${{ github.event.issue.repository.full_name }} | |
fetch-depth: 0 | |
- name: Set up Node.js | |
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | |
with: | |
node-version: 20 | |
cache: npm | |
- name: Install dependencies | |
run: npm install | |
- name: Update Vitest Snapshots | |
run: npm test -- -u | |
- name: Commit and push changes | |
run: | | |
git config --global user.name "GitHub Action" | |
git config --global user.email "action@github.com" | |
git add . | |
if git diff-index --quiet HEAD; then | |
echo "NO_CHANGES_DETECTED=1" >> "${GITHUB_ENV}" | |
else | |
git commit -m "Update Vitest Snapshots" | |
git push | |
fi | |
- name: Add comment | |
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
${{ env.NO_CHANGES_DETECTED == '1' && 'No snapshot changes detected.' || 'Snapshots updated and changes pushed to the PR.' }} |