Skip to content

Imports Validation Schemas into the Examples README during CI #2

Imports Validation Schemas into the Examples README during CI

Imports Validation Schemas into the Examples README during CI #2

name: Examples README hydration
on:
pull_request:
types:
- closed
branches: [ 'main']
paths:
- 'examples/**/*'
- '!examples/README.md'
jobs:
build:
if: github.repository == 'serverlessworkflow/specification' && github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.BOT_PAT }}
- uses: actions/setup-node@v4
with:
node-version: 21
- name: Import GPG key
id: import-gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.BOT_GPG_PRIVATE_KEY }}
git_config_global: true
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true
- run: |
set -e
# Reset origin
git remote set-url origin https://${{ secrets.BOT_USERNAME }}:${{ secrets.BOT_PAT }}@github.com/${{ github.repository }}.git
git checkout ${{ github.ref_name }}
# Create a new git branch
git checkout -b automation-examples-readme-${{ github.event.pull_request.number }}
# Install & run JS scripts
cd .ci/examples-readme-hydration/
npm ci
npm start
# Commit & push changes
git config user.name '${{ secrets.BOT_USERNAME }}'
git config user.email '${{ secrets.BOT_EMAIL }}'
git commit -S -a -m 'Rebuilt examples README.md'
git push origin automation-examples-readme-${{ github.event.pull_request.number }}
# Create a PR on GH
gh pr create -B main -H automation-examples-readme-${{ github.event.pull_request.number }} --title '[From CI] Rebuilt examples README' --body 'Automatic hydration of examples README.md'
env:
GITHUB_TOKEN: ${{ secrets.BOT_PAT }}