@@ -147,37 +147,58 @@ runs:
147147
148148 - name : Run MyPy
149149 run : |
150- echo "::debug file=action.yml,line=106::Running MyPy with options: ${{ inputs.mypy_options }}"
151- mypy ${{ inputs.mypy_options }} . 2>&1 | tee mypy_output.txt
152- echo "MYPY_EXIT_CODE=$?" >> $GITHUB_ENV
153- echo "::debug file=action.yml,line=110::MyPy completed with exit code ${{ env.MYPY_EXIT_CODE }}"
150+ if [ -z "${{ inputs.mypy_options }}" ]; then
151+ echo "::debug file=action.yml,line=105::No MyPy options provided, using default."
152+ mypy . 2>&1 | tee mypy_output.txt
153+
154+ if [ $? -eq 0 ]; then
155+ echo "::debug file=action.yml,line=108::MyPy completed successfully with default options."
156+ echo "MYPY_EXIT_CODE=0" >> $GITHUB_ENV
157+ exit 0
158+ else
159+ echo "::debug file=action.yml,line=110::MyPy found issues with default options."
160+ echo "MYPY_EXIT_CODE=1" >> $GITHUB_ENV
161+ exit 1
162+ fi
163+ else
164+ echo "::debug file=action.yml,line=107::Using MyPy options: ${{ inputs.mypy_options }}"
165+ mypy ${{ inputs.mypy_options }} . 2>&1 | tee mypy_output.txt
166+ if [ $? -eq 0 ]; then
167+ echo "::debug file=action.yml,line=112::MyPy completed successfully with custom options."
168+ echo "MYPY_EXIT_CODE=0" >> $GITHUB_ENV
169+ exit 0
170+ else
171+ echo "::debug file=action.yml,line=114::MyPy found issues with custom options."
172+ echo "MYPY_EXIT_CODE=1" >> $GITHUB_ENV
173+ exit 1
174+ fi
175+ fi
154176 shell : bash
155177 if : always()
156178
157179 - name : Report MyPy results
158180 run : |
159- if [ "$MYPY_EXIT_CODE" == "0" ]; then
160- if [ -z "$(cat mypy_output.txt)" ]; then
161- echo "::notice file=action.yml,line=115::No type checking issues found."
162- else
163- echo "::warning file=action.yml,line=145::Mypy output present despite zero exit code."
164- echo "Mypy output present despite zero exit code." > mypy_output.txt
165- fi
166- echo "::notice file=action.yml,line=120::All type checks passed."
167- else
168- echo "::error file=action.yml,line=150::Type checking issues found."
169- if [ -z "$(cat mypy_output.txt)" ]; then
170- echo "::warning file=action.yml,line=153::No output from mypy, but exit code indicates issues."
171- fi
181+ if [ "${MYPY_EXIT_CODE}" == "0" ]; then
182+ export MYPY_OUTPUT=$(cat mypy_output.txt)
183+
184+ if [ -z "${MYPY_OUTPUT}" ]; then
185+ echo "::warning file=action.yml,line=159::No mypy output but exit code indicates success."
172186 fi
173- echo "## MyPy Results :hammer:" >> $GITHUB_STEP_SUMMARY
174- echo "" >> $GITHUB_STEP_SUMMARY
175- echo '```text' >> $GITHUB_STEP_SUMMARY
176- cat mypy_output.txt >> $GITHUB_STEP_SUMMARY
177- echo '```' >> $GITHUB_STEP_SUMMARY
178- echo "" >> $GITHUB_STEP_SUMMARY
179- echo "::debug file=action.yml,line=138::Removing temporary mypy output file."
180- rm -f mypy_output.txt
187+ else
188+ echo "::error file=action.yml,line=159::Mypy issues found."
189+ fi
190+ echo "## MyPy Results :hammer:" >> $GITHUB_STEP_SUMMARY
191+ echo "" >> $GITHUB_STEP_SUMMARY
192+ echo '```text' >> $GITHUB_STEP_SUMMARY
193+ cat mypy_output.txt >> $GITHUB_STEP_SUMMARY
194+ echo '```' >> $GITHUB_STEP_SUMMARY
195+ echo "" >> $GITHUB_STEP_SUMMARY
196+ rm -f mypy_output.txt
197+ if [[ ! -f mypy_output.txt ]]; then
198+ echo "::debug file=action.yml,line=170::Temporary mypy output file removed successfully."
199+ else
200+ echo "::warning file=action.yml,line=174::Failed to remove temporary mypy output file."
201+ fi
181202 shell : bash
182203 if : always()
183204
@@ -284,26 +305,36 @@ runs:
284305 echo "::warning file=action.yml,line=274::Failed to add mypy badge. Directory may not exist."
285306 fi
286307
287- echo "::notice file=action.yml,line=284::Badge files added to staging area."
308+ git status --porcelain
309+ if [ $? -eq 0 ]; then
310+ echo "::debug file=action.yml,line=287::Git status checked successfully."
311+ else
312+ echo "::warning file=action.yml,line=287::Failed to check git status."
313+ fi
288314
289- echo "::debug file=action.yml,line=288::Checking for changes to commit."
290-
315+ echo "::debug file=action.yml,line=295::Checking for changes to commit."
291316 git diff --staged --quiet
292317
293318 if [ $? -eq 0 ]; then
294- echo "::notice file=action.yml,line=277 ::No changes to commit."
319+ echo "::notice file=action.yml,line=295 ::No changes to commit."
295320 exit 0
296321 fi
297- echo "::notice file=action.yml,line=281 ::Committing and pushing badge changes to repository."
322+ echo "::debug file=action.yml,line=302 ::Committing changes to repository."
298323 git commit -m "Update linting badges [skip ci]"
324+ if [ $? -eq 0 ]; then
325+ echo "::notice file=action.yml,line=302::Changes committed to repository."
326+ else
327+ echo "::warning file=action.yml,line=303::Failed to commit changes to repository."
328+ fi
299329
330+ echo "::debug file=action.yml,line=310::Pushing changes to repository."
300331 git push
301332
302333 if [ $? -eq 0 ]; then
303- echo "::notice file=action.yml,line=282 ::Changes committed and pushed to repository."
334+ echo "::notice file=action.yml,line=310 ::Changes committed and pushed to repository."
304335 else
305- echo "::warning file=action.yml,line=283 ::Failed to push changes to repository."
306- echo "::notice file=action.yml,line=284 ::This may be due to insufficient permissions or a merge conflict."
336+ echo "::warning file=action.yml,line=310 ::Failed to push changes to repository."
337+ echo "::notice file=action.yml,line=312 ::This may be due to insufficient permissions or a merge conflict."
307338 echo ""
308339 exit 0
309340 fi
0 commit comments