Skip to content

Commit 94899a7

Browse files
[STYLE] Fixed a few overlooked mistakes as found in review (- PR #414 -)
Changes in file .github/actions/test-reporter-upload/action.yml: * removed unused inputs * refactored some logic * related work Changes in file .github/workflows/Tests.yml: * related work
1 parent 84d7d0d commit 94899a7

File tree

2 files changed

+12
-22
lines changed

2 files changed

+12
-22
lines changed

.github/actions/test-reporter-upload/action.yml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@ inputs:
4040
- Linux
4141
- Windows
4242
required: true
43-
token:
44-
description: |
45-
The token used to authenticate when performing GitHub API operations.
46-
When running this action on github.com, the default value is sufficient. When running on
47-
GHES, you can pass a personal access token for github.com if you are experiencing
48-
rate limiting.
49-
default: ${{ github.server_url == 'https://github.com' && github.token || '' }}
50-
required: true
5143
secrets:
5244
codeclimate-token:
5345
description: |
@@ -102,8 +94,8 @@ runs:
10294
id: output_sha
10395
shell: bash
10496
run: |
105-
printf "sha=%s\n" $(git rev-parse --verify '${{ inputs.sha }}') >> "$GITHUB_OUTPUT"
106-
printf "BUILD_SHA=%s\n" $(git rev-parse --verify '${{ inputs.sha }}') >> "$GITHUB_ENV"
97+
printf "sha=%s\n" $(git rev-parse --verify HEAD) >> "$GITHUB_OUTPUT"
98+
printf "BUILD_SHA=%s\n" $(git rev-parse --verify HEAD) >> "$GITHUB_ENV"
10799
- name: "Identify Python Version"
108100
id: output_python
109101
if: ${{ !cancelled() }}
@@ -129,7 +121,7 @@ runs:
129121
printf "os=%s\n" "${OS_INPUT}" >> "$GITHUB_OUTPUT"
130122
OS=${OS_INPUT}
131123
else
132-
printf "os=%s\n" "${OS:-'unknown'}" >> "$GITHUB_OUTPUT"
124+
printf "os=%s\n" "${OS:-unknown}" >> "$GITHUB_OUTPUT"
133125
fi
134126
printf "%s\n" "OS=${OS}" >> "$GITHUB_ENV"
135127
- name: "Prepare Artifact Name"
@@ -171,7 +163,7 @@ runs:
171163
if [[ -x "${BINDIR:-${LOCALBIN}}/deepsource" ]] ; then
172164
printf "can_upload_to_deepsource=true\n" >> "$GITHUB_OUTPUT"
173165
printf "::debug::%s\n" "Found ${BINDIR:-${LOCALBIN}}/deepsource"
174-
printf "deepsource_executable=${BINDIR:-${LOCALBIN}}/deepsource\n" >> "$GITHUB_OUTPUT"
166+
printf "deepsource_executable=%s\n" "${BINDIR:-${LOCALBIN}}/deepsource" >> "$GITHUB_OUTPUT"
175167
else
176168
printf "::warning, title='Missing tool':: %s\n" "Can't find deepsource tool."
177169
printf "can_upload_to_deepsource=false\n" >> "$GITHUB_OUTPUT"
@@ -181,7 +173,7 @@ runs:
181173
if [[ -x $(command -v coveralls) ]] ; then
182174
printf "can_upload_to_coveralls=true\n" >> "$GITHUB_OUTPUT"
183175
printf "::debug::%s %s\n" "Found" $(command -v coveralls)
184-
printf "coveralls_executable=%s\n" $(command -v coveralls)" >> "$GITHUB_OUTPUT"
176+
printf "coveralls_executable=%s\n" $(command -v coveralls) >> "$GITHUB_OUTPUT"
185177
else
186178
printf "::warning, title='Missing tool':: %s\n" "Can't find coveralls tool."
187179
printf "can_upload_to_coveralls=false\n" >> "$GITHUB_OUTPUT"
@@ -224,7 +216,7 @@ runs:
224216
rm -f coverage_codecov 2>/dev/null || true ; wait ;
225217
printf "\n\n" >> "${GITHUB_STEP_SUMMARY}"
226218
fi
227-
if [[ -d "${{ github.workspace }}/test-reports/coverage.xml" ]] ; then
219+
if [[ -f "${{ github.workspace }}/test-reports/coverage.xml" ]] ; then
228220
printf "can_upload_to_codecov=true\n" >> "$GITHUB_OUTPUT"
229221
else
230222
printf "can_upload_to_codecov=false\n" >> "$GITHUB_OUTPUT"
@@ -308,7 +300,7 @@ runs:
308300
CODECLIMATE_REPO_TOKEN: ${{ github.server_url == 'https://github.com' && secrets.codeclimate-token || '' }}
309301
CC_TEST_REPORTER_ID: ${{ github.server_url == 'https://github.com' && secrets.cc-test-reporter-id || '' }}
310302
run: |
311-
if [[ "${{ input.tests-outcome }}" == "success" ]] ; then
303+
if [[ "${{ inputs.tests-outcome }}" == "success" ]] ; then
312304
./cc-test-reporter after-build --exit-code 0 || exit 1 ;
313305
else
314306
./cc-test-reporter after-build --exit-code 1 || exit 1 ;
@@ -330,7 +322,7 @@ runs:
330322
COVERALLS_REPO_TOKEN: ${{ github.server_url == 'https://github.com' && secrets.coveralls-token || '' }}
331323
COVERALLS_TOOL: ${{ steps.output_upload_tools.outputs.coveralls_executable }}
332324
run: |
333-
if [[ "${{ input.tests-outcome }}" == "success" ]] ; then
325+
if [[ "${{ inputs.tests-outcome }}" == "success" ]] ; then
334326
${COVERALLS_TOOL} report test-reports/coverage.xml --base-path="${{ github.workspace }}" --format=python --service-job-id=${{ github.run_id }} --parallel --job-flag='${{ steps.output_os.outputs.os }}-${{ steps.output_python.outputs.python-version }}' --build-number=${{ inputs.job_code }} || exit 1 ;
335327
else
336328
${COVERALLS_TOOL} report test-reports/coverage.xml --base-path="${{ github.workspace }}" --allow-empty --format=python --service-job-id=${{ github.run_id }} --parallel --job-flag='${{ steps.output_os.outputs.os }}-${{ steps.output_python.outputs.python-version }}' --build-number=${{ inputs.job_code }} || exit 1 ;
@@ -341,7 +333,7 @@ runs:
341333
shell: bash
342334
run: |
343335
if [[ "${{ steps.output_can_upload.outputs.can_upload }}" == "true" ]] ; then
344-
if [[ "${{ input.tests-outcome }}" == "success" ]] ; then
336+
if [[ "${{ inputs.tests-outcome }}" == "success" ]] ; then
345337
THE_RESULT="success"
346338
else
347339
THE_RESULT="neutral"

.github/workflows/Tests.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ jobs:
246246
os: ${{ runner.os }}
247247
python-version: ${{ matrix.python-version }}
248248
job_code: ${{ needs.check_mats.outputs.tests_id }}
249-
token: ${{ github.server_url == 'https://github.com' && github.token || '' }}
250249
secrets:
251250
deepsource-dsn: ${{ github.server_url == 'https://github.com' && secrets.DEEPSOURCE_DSN || '' }}
252251
coveralls-token: ${{ github.server_url == 'https://github.com' && secrets.COVERALLS_REPO_TOKEN || '' }}
@@ -296,7 +295,7 @@ jobs:
296295
else
297296
THE_RESULT="failure"
298297
fi
299-
if [[ "${{ steps.steps.upload-test-tools.outputs.coverage_codeclimate_upload_outcome }}" != "failure" && "${THE_RESULT}" == "success" ]] ; then
298+
if [[ "${{ steps.upload-test-tools.outputs.coverage_codeclimate_upload_outcome }}" != "failure" && "${THE_RESULT}" == "success" ]] ; then
300299
THE_RESULT="success"
301300
else
302301
THE_RESULT="failure"
@@ -353,10 +352,10 @@ jobs:
353352
printf "%s\n" " * :black_square_button: Uploading unit-tests coverage report to CodeCov was skipped" >> "$COV_STEP_SUMMARY"
354353
fi
355354
fi
356-
if [[ "${{ steps.steps.upload-test-tools.outputs.coverage_codeclimate_upload_outcome }}" == "success" ]] ; then
355+
if [[ "${{ steps.upload-test-tools.outputs.coverage_codeclimate_upload_outcome }}" == "success" ]] ; then
357356
printf "%s\n" " * :arrow_up: Uploading unit-tests coverage report to codeclimate succeeded" >> "$COV_STEP_SUMMARY"
358357
else
359-
if [[ "${{ steps.steps.upload-test-tools.outputs.coverage_codeclimate_upload_outcome }}" == "failed" ]] ; then
358+
if [[ "${{ steps.upload-test-tools.outputs.coverage_codeclimate_upload_outcome }}" == "failed" ]] ; then
360359
printf "%s\n" " * :no_entry: Uploading unit-tests coverage report to codeclimate failed" >> "$COV_STEP_SUMMARY"
361360
else
362361
printf "%s\n" " * :black_square_button: Uploading unit-tests coverage report to codeclimate was skipped" >> "$COV_STEP_SUMMARY"
@@ -516,7 +515,6 @@ jobs:
516515
os: ${{ runner.os }}
517516
python-version: ${{ matrix.python-version }}
518517
job_code: ${{ needs.check_mats.outputs.tests_id }}
519-
token: ${{ github.server_url == 'https://github.com' && github.token || '' }}
520518
secrets:
521519
deepsource-dsn: ${{ github.server_url == 'https://github.com' && secrets.DEEPSOURCE_DSN || '' }}
522520
coveralls-token: ${{ github.server_url == 'https://github.com' && secrets.COVERALLS_REPO_TOKEN || '' }}

0 commit comments

Comments
 (0)