Skip to content

assets-docs

assets-docs #4

Workflow file for this run

name: assets-docs
on:
push:
branches:
- release
paths-ignore:
- .github/**
- test/**
schedule:
- cron: '30 8 * * *'
workflow_dispatch:
concurrency: ${{ github.workflow }}
env:
main_dir: main
release_dir: release
wiki_dir: wiki
scripts_azureml_assets_dir: scripts/azureml-assets
scripts_docs_dir: scripts/docs
docs_dir: docs
permissions:
# Required to clone repo
contents: read
defaults:
run:
shell: bash
jobs:
release-assets:
name: Update documentation
# if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Clone branch
uses: actions/checkout@v3
with:
fetch-depth: 1
path: ${{ env.main_dir }}
- name: Clone release branch
uses: actions/checkout@v3
with:
ref: release
fetch-depth: 1
path: ${{ env.release_dir }}
- name: Clone wiki
uses: actions/checkout@v3
with:
repository: Azure/azureml-assets.wiki
fetch-depth: 0
token: ${{ secrets.AZUREML_BOT_PAT }}
path: ${{ env.wiki_dir }}
- name: Use Python 3.10 or newer
uses: actions/setup-python@v4
with:
python-version: '>=3.10'
- name: Install dependencies
run: pip install -e $main_dir/$scripts_azureml_assets_dir -r $main_dir/$scripts_docs_dir/requirements.txt
- name: Clean up wiki
run: |
rm -rf $docs_dir
mkdir $docs_dir
working-directory: ${{ env.wiki_dir }}
- name: Generate asset documentation
run: |
python $GITHUB_WORKSPACE/$main_dir/$scripts_docs_dir/parse_assets.py -i $GITHUB_WORKSPACE/$release_dir/latest
working-directory: ${{ env.wiki_dir }}/${{ env.docs_dir }}
- name: Create commit and push
env:
GIT_AUTHOR_NAME: github-actions[bot]
GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
GIT_COMMITTER_NAME: GitHub
GIT_COMMITTER_EMAIL: noreply@github.com
run: |
if [[ -z $(git status -s) ]]; then
echo "No updates to the wiki"
exit 0
fi
git add -A .
git commit -m "Update azureml-assets wiki" -m "Automated updates made by [$GITHUB_WORKFLOW]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID)"
git push
working-directory: ${{ env.wiki_dir }}