Skip to content

Merge pull request #6 from anandhu-eng/main #2

Merge pull request #6 from anandhu-eng/main

Merge pull request #6 from anandhu-eng/main #2

# This workflow will add/update the README.md files for any updated CM scripts
name: CM(CK2) Readme update for CM scripts
on:
push:
branches: [ "main", "dev" ]
paths:
- 'script/**_cm.json'
jobs:
doreadme:
runs-on: ubuntu-latest
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 mlcommons@ck
cm pull repo --url=https://github.com/${{ github.repository }} --checkout=${{ github.ref_name }}
python3 tests/script/process_readme.py ${{ steps.getfile.outputs.files }}
FOLDER=`cm find repo GATEOverflow@topic-classification | cut -d' ' -f3`
cd $FOLDER
echo "Changed to $FOLDER"
USER=admin
EMAIL=admin@gateoverflow.org
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")