Skip to content

Commit 2705e93

Browse files
authored
Dockerflie check (#609)
Signed-off-by: ZePan110 <[email protected]>
1 parent 824a7e2 commit 2705e93

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.github/workflows/pr-dockerfile-path-scan.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,34 @@ jobs:
118118
echo "Please modify the corresponding README in GenAIExamples repo and ask [email protected] for final confirmation."
119119
exit 1
120120
fi
121+
122+
Dockerfile-addition-detection-in-GenAIComps:
123+
runs-on: ubuntu-latest
124+
steps:
125+
- name: Clean Up Working Directory
126+
run: sudo rm -rf ${{github.workspace}}/*
127+
128+
- name: Checkout code
129+
uses: actions/checkout@v4
130+
with:
131+
fetch-depth: 0
132+
133+
- name: Check if the Dockerfile has been added
134+
run: |
135+
set -e
136+
shopt -s globstar
137+
cd ${{github.workspace}}
138+
is_use="FALSE"
139+
used_files=""
140+
merged_commit=$(git log -1 --format='%H')
141+
changed_files="$(git diff --name-status --diff-filter=A ${{ github.event.pull_request.base.sha }} ${merged_commit} -- '**/Dockerfile**' | cut -f2)"
142+
if [ -n "$changed_files" ]; then
143+
for file in $changed_files; do
144+
if find "${{github.workspace}}/.github/workflows/docker/compose/" -name "*$(echo "$file" | awk -F '/' '{print $2}')*" |grep -q .; then
145+
echo "Please check if the added $file is included in the yaml under path ${{github.workspace}}/.github/workflows/docker/compose/."
146+
else
147+
echo "Please create a new compose file named service_name-compose-cd.yaml in ${{github.workspace}}/.github/workflows/docker/compose/ for $file and fill it in."
148+
fi
149+
done
150+
exit 1
151+
fi

0 commit comments

Comments
 (0)