Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat empty input strings as None #198

Merged
merged 2 commits into from Dec 1, 2021

Conversation

EnricoMi
Copy link
Owner

@EnricoMi EnricoMi commented Nov 30, 2021

Composite action calls into the Docker image and sets all supported inputs. Here, originally unset inputs are set as empty strings:

env:
GITHUB_TOKEN: ${{ inputs.github_token }}
GITHUB_RETRIES: ${{ inputs.github_retries }}
COMMIT: ${{ inputs.commit }}
CHECK_NAME: ${{ inputs.check_name }}
COMMENT_TITLE: ${{ inputs.comment_title }}
FAIL_ON: ${{ inputs.fail_on }}
FILES: ${{ inputs.files }}
REPORT_INDIVIDUAL_RUNS: ${{ inputs.report_individual_runs }}
DEDUPLICATE_CLASSES_BY_FILE_NAME: ${{ inputs.deduplicate_classes_by_file_name }}
HIDE_COMMENTS: ${{ inputs.hide_comments }}
COMMENT_ON_PR: ${{ inputs.comment_on_pr }}
COMMENT_MODE: ${{ inputs.comment_mode }}
COMPARE_TO_EARLIER_COMMIT: ${{ inputs.compare_to_earlier_commit }}
PULL_REQUEST_BUILD: ${{ inputs.pull_request_build }}
EVENT_FILE: ${{ inputs.event_file }}
EVENT_NAME: ${{ inputs.event_name }}
TEST_CHANGES_LIMIT: ${{ inputs.test_changes_limit }}
CHECK_RUN_ANNOTATIONS: ${{ inputs.check_run_annotations }}
CHECK_RUN_ANNOTATIONS_BRANCH: ${{ inputs.check_run_annotations_branch }}
SECONDS_BETWEEN_GITHUB_READS: ${{ inputs.seconds_between_github_reads }}
SECONDS_BETWEEN_GITHUB_WRITES: ${{ inputs.seconds_between_github_writes }}
ROOT_LOG_LEVEL: ${{ inputs.root_log_level }}
LOG_LEVEL: ${{ inputs.log_level }}

The event_file arguments turns out to be the only effected by this, all other have defaults for None and empty strings. This PR turns empty input strings into proper Nones. This makes the "running-on-a-fork-PR" check in main work for the composite action (where settings.event_file is not None but an empty string):

if settings.event_file is None and \
settings.event_name == 'pull_request' and \
settings.event.get('pull_request', {}).get('head', {}).get('repo', {}).get('full_name') != settings.repo:
# bump the version if you change the target of this link (if it did not exist already) or change the section
gha.warning(f'This action is running on a pull_request event for a fork repository. '
f'It cannot do anything useful like creating check runs or pull request comments. '
f'To run the action on fork repository pull requests, see '
f'https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#support-fork-repositories-and-dependabot-branches')
return

As @BlasiusSecundus showed in #188 (comment), the composite action fails on a fork PR because it tries to write-access the API, which fails with 403, which is retried. We have to retry all 403 because we cannot distinguish between 403 responses that are retry-able due to rate-limit (#150, #170) and those that are not retry-able because we are running in a fork repository context (#167). The "running-on-a-fork-PR" check is supposed to avoid the latter case.

@github-actions

This comment has been minimized.

@github-actions
Copy link

github-actions bot commented Nov 30, 2021

Unit Test Results (Linux)

     15 files  ±  0       15 suites  ±0   40s ⏱️ +7s
   251 tests +  3     251 ✔️ +  3    0 💤 ±0  0 ±0 
3 765 runs  +45  3 725 ✔️ +45  40 💤 ±0  0 ±0 

Results for commit 3949fda. ± Comparison against base commit fbe06cd.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Nov 30, 2021

Unit Test Results (macOS)

     15 files  ±  0       15 suites  ±0   40s ⏱️ +7s
   251 tests +  3     251 ✔️ +  3    0 💤 ±0  0 ±0 
3 765 runs  +45  3 725 ✔️ +45  40 💤 ±0  0 ±0 

Results for commit 3949fda. ± Comparison against base commit fbe06cd.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Nov 30, 2021

Unit Test Results (Windows)

     15 files  ±  0       15 suites  ±0   40s ⏱️ +7s
   251 tests +  3     251 ✔️ +  3    0 💤 ±0  0 ±0 
3 765 runs  +45  3 725 ✔️ +45  40 💤 ±0  0 ±0 

Results for commit 3949fda. ± Comparison against base commit fbe06cd.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Nov 30, 2021

Unit Test Results (Dockerfile)

     15 files  ±  0       15 suites  ±0   40s ⏱️ +7s
   251 tests +  3     251 ✔️ +  3    0 💤 ±0  0 ±0 
3 765 runs  +45  3 725 ✔️ +45  40 💤 ±0  0 ±0 

Results for commit 3949fda. ± Comparison against base commit fbe06cd.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Nov 30, 2021

Unit Test Results (Docker Image)

     15 files  ±  0       15 suites  ±0   40s ⏱️ +7s
   251 tests +  3     251 ✔️ +  3    0 💤 ±0  0 ±0 
3 765 runs  +45  3 725 ✔️ +45  40 💤 ±0  0 ±0 

Results for commit 3949fda. ± Comparison against base commit fbe06cd.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Nov 30, 2021

Unit Test Results (Test Files)

  24 files  ±0      4 errors  21 suites  ±0   39m 12s ⏱️ ±0s
272 tests ±0  227 ✔️ ±0  18 💤 ±0  23 ±0  4 🔥 ±0 
437 runs  ±0  354 ✔️ ±0  53 💤 ±0  25 ±0  5 🔥 ±0 

For more details on these parsing errors, failures and errors, see this check.

Results for commit 3949fda. ± Comparison against base commit fbe06cd.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Nov 30, 2021

Unit Test Results (reference)

     15 files  ±  0       15 suites  ±0   40s ⏱️ +7s
   251 tests +  3     251 ✔️ +  3    0 💤 ±0  0 ±0 
3 765 runs  +45  3 725 ✔️ +45  40 💤 ±0  0 ±0 

Results for commit 3949fda. ± Comparison against base commit fbe06cd.

♻️ This comment has been updated with latest results.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@EnricoMi EnricoMi force-pushed the branch-treat-empty-input-strings-as-none branch from f9c9087 to 99b0351 Compare November 30, 2021 22:56
@EnricoMi EnricoMi force-pushed the branch-treat-empty-input-strings-as-none branch from db33737 to 3949fda Compare November 30, 2021 22:58
@github-actions
Copy link

Unit Test Results (setup-python)

     15 files  ±  0       15 suites  ±0   40s ⏱️ +7s
   251 tests +  3     251 ✔️ +  3    0 💤 ±0  0 ±0 
3 765 runs  +45  3 725 ✔️ +45  40 💤 ±0  0 ±0 

Results for commit 3949fda. ± Comparison against base commit fbe06cd.

@EnricoMi EnricoMi merged commit 5005462 into master Dec 1, 2021
@EnricoMi EnricoMi deleted the branch-treat-empty-input-strings-as-none branch December 1, 2021 10:25
ilent2 pushed a commit to ilent2/publish-unit-test-result-action that referenced this pull request Dec 13, 2021
ilent2 added a commit to ilent2/publish-unit-test-result-action that referenced this pull request Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant