name: "Create minimal"

on:
  workflow_run:
    workflows: ["Publish NPM"]
    types:
      - completed
  workflow_dispatch:

jobs:
  create-minimal:
    if: github.repository == 'sfajs/cli'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          persist-credentials: false
          fetch-depth: 0
      - uses: actions/setup-node@v2
        with:
          node-version: "16"
          registry-url: https://registry.npmjs.org/
      - run: sh scripts/create-minimal.sh

      - name: push
        uses: ad-m/github-push-action@master
        with:
          directory: minimal
          repository: sfajs/cli
          force: true
          branch: minimal
          github_token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
