update_embed_demos #326
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 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 }} |