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

chore(ci): add workflow to update snapshots on schedule #850

Merged
merged 2 commits into from
Jan 1, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/update-snapshots.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Update Snapshots

on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:

jobs:
update-snapshots:
runs-on: ubuntu-latest

steps:
- name: 🛎 Checkout
uses: actions/checkout@v4

- name: 🏗 Setup node
uses: actions/setup-node@v4
with:
node-version-file: .node-version
registry-url: 'https://registry.npmjs.org'

- name: Setup pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
run_install: false

- name: 📂 Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- name: 📂 Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: 👨🏻‍💻 Install dependencies
run: |
pnpm install --frozen-lockfile --prefer-frozen-lockfile

- name: 🏃 Update snapshot
run: pnpm test -- -u

- name: Commit and push changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git checkout -b update-snapshots
git add .
git commit -m 'Update snapshots'
git push origin update-snapshots

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: update-snapshots
title: 'Update snapshots'
body: 'This PR updates the snapshots.'
assignees: 'book000'
Loading