Skip to content

Update example gallery #128

Update example gallery

Update example gallery #128

name: Update example gallery # Updates examples once a month
on:
workflow_dispatch:
schedule:
- cron: '0 0 15 * *' # At 12:00 AM, on day 15 of the month
jobs:
check_gallery:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: yarn
- name: Cache dependencies
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 #4.2.0
with:
path: '**/node_modules'
key: check-gallery-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
- name: Install
run: yarn
- name: Generate token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a #v2.1.0
id: generate_token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Check gallery
id: up_to_date
run: |
yarn update-gallery-config
if [[ `git status --porcelain` ]]; then
echo "::error ::The gallery is out of date, run yarn update-gallery-config"
echo "The following items are out of date."
git status --porcelain
exit 1
else
echo "Gallery is up-to-date"
exit 0
fi
- name: Create pull request
if: failure() && steps.up_to_date.outcome == 'failure'
id: create-pr
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.generate_token.outputs.token }}
commit-message: 'chore: update example gallery'
committer: GitHub <[email protected]>
author:
${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
branch: 'update-examples'
branch-suffix: random
title: 'chore: update example gallery'
body: |
This PR was automatically generated to update provided examples.
The goal is to keep our examples up-to-date with the latest changes from our own package.
#### What did you change?
This action ran `yarn update-gallery-config` to update examples as necessary.
#### How did you test and verify your work?
This PR should only be merged reviewing the following checks:
- [ ] `yarn ci-check` runs cleanly and all tests pass.
- [ ] Storybook runs correctly in the Netlify deploy-preview.
- [ ] Updated components render correctly in the examples section of Storybook.