Skip to content

Merge pull request #7 from anandhu-eng/main #3

Merge pull request #7 from anandhu-eng/main

Merge pull request #7 from anandhu-eng/main #3

# This workflow will add/update the default dockerfile for any updated CM scripts
name: CM(CK2) Dockerfile 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 dockerfile
run: |
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_dockerfile.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`
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 *.Dockerfile
git diff-index --quiet HEAD || (git commit -am "Updated dockerfile" && git push)