Skip to content

Merge from Ctuning (#1128) #177

Merge from Ctuning (#1128)

Merge from Ctuning (#1128) #177

# This workflow will add/update the README.md files for any updated CM scripts
name: Readme update for CM scripts
on:
push:
branches: [ "master", "dev" ]
paths:
- 'cm-mlops/script/**_cm.json'
jobs:
doreadme:
runs-on: ubuntu-latest
if: github.repository == 'mlcommons/ck'
steps:
- name: 'Checkout'
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get changed files
id: getfile
run: |
echo "files=$(git diff --name-only ${{ github.event.before }} | xargs)" >> $GITHUB_OUTPUT
- name: Update readme
run: |
echo ${{ steps.getfile.outputs.files }}
for file in ${{ steps.getfile.outputs.files }}; do
echo $file
done
python3 -m pip install cmind
cm pull repo --url=https://github.com/${{ github.repository }} --checkout=${{ github.ref_name }}
python3 tests/script/process_readme.py ${{ steps.getfile.outputs.files }}
#REPO=${{ github.repository }}
#CM_REPO=${REPO/\//@}
#FOLDER=`cm find repo ${CM_REPO} | cut -d' ' -f3`
FOLDER=`cm find repo mlcommons@ck | cut -d' ' -f3`
cd $FOLDER
echo "Changed to $FOLDER"
USER=cTuning
[email protected]
git config --global user.name "$USER"
git config --global user.email "$EMAIL"
git remote set-url origin https://x-access-token:${{ secrets.ACCESS_TOKEN }}@github.com/${{ github.repository }}
git add *.md
git diff-index --quiet HEAD || (git commit -am "Updated docs" && git push && echo "Changes pushed")