-
Notifications
You must be signed in to change notification settings - Fork 6
56 lines (50 loc) · 1.56 KB
/
update-demos.yml
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
54
55
56
name: Update Demos
on:
push:
branches: [main]
workflow_dispatch:
repository_dispatch:
types: update_embed_demos
jobs:
update-demos:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- name: Checkout embed
uses: actions/checkout@v2
with:
repository: Typeform/embed
path: embed
- name: Checkout current (embed-demo) repo
uses: actions/checkout@v2
with:
path: demo
ref: main
persist-credentials: false
token: ${{ secrets.GH_TOKEN }}
- name: Install deps
working-directory: demo
run: yarn
- name: Run script to generate demos
working-directory: demo
run: |
yarn deploy
yarn lint
- name: Check if there are any changes
id: check-for-changes
working-directory: demo
run: |
git status
echo "name=no_changes::$(git status | grep -c "nothing to commit")"
echo "::set-output name=no_changes::$(git status | grep -c "nothing to commit")"
- name: Commit generated demos
if: steps.check-for-changes.outputs.no_changes == 0
working-directory: demo
run: |
git config --global user.email "you@example.com"
git config --global user.name "Github Action"
git add .
git commit -m "[skip ci] update demos"
git push https://$GITHUB_TOKEN@github.com/Typeform/embed-demo.git
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}