My requirement is to iterate through checked in files in a loop and perform the action:
My GitHub Actions workflow is:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout repo content
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: identify different Configuration files
run: |
echo "Check-in configuration files are"
files=$(git diff --name-only HEAD^..HEAD)
echo $files
echo "Stating exeuction"
IFS=" "
for i in $files
do
echo Hiiii
echo $i
echo Byeee
done
However, it is returning output like:
Check-in configuration files are
.github/workflows/model_registry.yml config/approve/apprv_xgboost_model.ini config/register/modoel-1.ini config/update/updt_model-2.ini
Stating exeuction
Hiiii
.github/workflows/model_registry.yml
config/approve/apprv_xgboost_model.ini
config/register/model-1.ini
config/update/updt_model-2.ini
Byeee
Same command when I am executing in git bash:
$ files=".github/workflows/model_registry.yml config/approve/apprv_xgboost_model.ini config/register/model-1.ini config/update/updt_model-2.ini"
$ IFS=" "
$ for i in $files
> do
> echo Hiiii
> echo $i
> echo byeee
> done
Hiiii
.github/workflows/model_registry.yml
byeee
Hiiii
config/approve/apprv_xgboost_model.ini
byeee
Hiiii
config/register/model-1.ini
byeee
Hiiii
config/update/updt_model-2.ini
byeee