Cleanup READMEs (#474) #2
This file contains hidden or 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
# This workflow will automatically update the README for any updated MLC script | |
name: Document script on modified meta | |
on: | |
push: | |
branches: [ "dev" ] | |
paths: | |
- 'script/**meta.yaml' | |
jobs: | |
get_modified_files: | |
runs-on: ubuntu-latest | |
outputs: | |
processed_files: ${{ steps.modified-files.outputs.processed_files }} | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
pip install pyyaml | |
- name: Get changed files | |
id: modified-files | |
env: | |
filter: ${{ github.event.before }} | |
run: | | |
changed_files=$(git diff --name-only $filter | grep -E '.*\.yaml$') | |
echo "$changed_files" | python3 .github/scripts/list_modified_files.py | |
document_modified_scripts: | |
runs-on: ubuntu-latest | |
needs: get_modified_files | |
if: ${{ needs.get_modified_files.outputs.processed_files != '[]' && needs.get_modified_files.outputs.processed_files != '' }} | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
modified_metas: ${{ fromJSON(needs.get_modified_files.outputs.processed_files).modified_metas }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
path: automation-scripts | |
- name: Set up Git for commit | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Document meta.yaml file | |
run: | | |
echo "Documenting ${{ matrix.modified_metas.file }}" | |
pip install mlcflow | |
mlc add repo automation-scripts | |
mlc doc script ${{ matrix.modified_metas.uid}} --quiet | |
cd automation-scripts | |
find . -type f -name README.md -exec git add {} + | |
# Use the GitHub actor's name and email | |
git config --global user.name github-actions[bot] | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
# Commit changes | |
git commit -m '[Automated Commit] Document ${{ matrix.modified_metas.file}} [skip ci]' | |
git push | |