name: Update Wiki Documentation

on:
  push:
    branches: [ master ]
  workflow_dispatch:

jobs:
  update_documentation:
    if: ${{ github.repository == 'genome/analysis-workflows' }}
    runs-on: ubuntu-latest

    steps:
      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: 3.7
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          python -m pip install 'setuptools>=18.5'
          python -m pip install 'cwltool==1.0.20181217162649'
          python -m pip install 'ruamel.yaml==0.15.77'
          python -m pip install 'mdutils==1.0.0'
          python -m pip install 'PyYAML==5.1.2'
      - name: Create CWL documentation
        env:
            WIKI_ACCESS_TOKEN: ${{secrets.WIKI_ACCESS_TOKEN}}
        run: |
          git clone "https://${WIKI_ACCESS_TOKEN}@github.com/genome/analysis-workflows.wiki.git"
          cd analysis-workflows.wiki/
          python scripts/create_cwl_documentation.py
          git add .
          git diff-index --quiet HEAD || git commit -m "Automated Documentation Update\n\nWorkflow run ${GITHUB_RUN_ID} on ${GITHUB_SHA}."
          git push

Migrate documentation generator to github actions.
Migrate documentation generator to github actions.
