I have shell script code running in GitHub Actions that gets changes and eventually what I want to happen is get an echo for each file with the file type and file name in the output.
echo "Git Add --all"
git add --all
echo "Add to Files:"
files= git diff --name-only --cached
echo "*************************************************************"
echo "GIT diff:"
echo ""
git diff --name-only --cached
echo ""
echo "*************************************************************"
echo "Files:"
echo $files
for file in $files; do
if [ "$file" == "*.cls" ] # this is the snag
then
echo "$file Class Updated"
fi
if [ "$file" == "*.flow" ] # this is the snag
then
echo "$file Flow Updated"
else
echo "$file not found"
fi
done
When running I get an output
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: src/classes/xxxx.cls
Untracked files:
(use "git add <file>..." to include in what will be committed)
src/flows/
no changes added to commit (use "git add" and/or "git commit -a")
Git Add --all
Add to Files:
src/classes/xxx.cls
src/flows/xxxx.flow
*************************************************************
GIT diff:
src/classes/xxx.cls
src/flows/xxxx.flow
*************************************************************
Files:
The files variable is not getting assigned the output from the git diff and does it look like once this happens the for loop will work?
Im an extreme novice when it comes to this and I'm very much in need of any assistance. Many thanks to all of those in the community