forked from hplush/slowreader
-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (53 loc) · 1.73 KB
/
visual.yml
File metadata and controls
53 lines (53 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Visual Test
on:
schedule:
- cron: '00 04 * * *' # Runs at night every day
push:
branches:
- main
paths:
- '.github/workflows/visual.yml'
permissions:
contents: read
jobs:
chromatic:
name: Chromatic
runs-on: ubuntu-latest
steps:
- name: Harden the runner
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: block
allowed-endpoints: >
api.github.com:443
chromatic-builds.s3.us-west-2.amazonaws.com:443
github.com:443
index.chromatic.com:443
nodejs.org:443
release-assets.githubusercontent.com:443
objects.githubusercontent.com:443
registry.npmjs.org:443
storybook.js.org:443
- name: Checkout the repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
- name: Check if should run
id: should_run
run: |
now=$(date -u +%s)
twenty_four_hours_ago=$((now - 86400))
last_commit_time=$(git log -1 --format=%ct)
if [ "$last_commit_time" -ge "$twenty_four_hours_ago" ]; then
echo "should_run=true" >> "$GITHUB_OUTPUT"
else
echo "should_run=false" >> "$GITHUB_OUTPUT"
fi
- name: Initialize Node.js
if: steps.should_run.outputs.should_run == 'true'
uses: ./.github/actions/init-node
- name: Publish to Chromatic
if: steps.should_run.outputs.should_run == 'true'
run: cd web && pnpm chromatic --skip-update-check
env:
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}