Conversation
There was a problem hiding this comment.
Pull request overview
Adds an opt-in workflow_dispatch input to control whether E2E test reports are uploaded, preventing automatic uploads on manually triggered runs unless explicitly requested.
Changes:
- Introduces a
test_report_uploadinput (defaultfalse) for manual workflow runs. - Updates conditional logic for uploading test reports to only run on push/PR events by default, or when explicitly enabled for
workflow_dispatch.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| .github/workflows/e2e-test.yml | Adds test_report_upload input and gates the report upload job for manual runs. |
| .github/workflows/e2e-test-pr.yml | Adds test_report_upload input and gates the “Upload test results” step for manual runs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| - name: Upload test results | ||
| if: always() | ||
| if: always() && github.repository == 'linode/linode_api4-python' && (github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.test_report_upload == 'true')) |
There was a problem hiding this comment.
github.repository == 'linode/linode_api4-python' does not exclude uploads for PRs coming from forks, because for pull_request events github.repository typically refers to the base repository (still linode/linode_api4-python). If the goal is to prevent uploads on fork PRs, gate on the PR head repo instead (e.g., github.event.pull_request.head.repo.full_name == github.repository or !github.event.pull_request.head.repo.fork) while keeping the current behavior for workflow_dispatch.
| if: always() && github.repository == 'linode/linode_api4-python' && (github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.test_report_upload == 'true')) | |
| if: always() && github.repository == 'linode/linode_api4-python' && ((github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'workflow_dispatch' && inputs.test_report_upload == 'true')) |
| needs: [integration-tests] | ||
| if: always() && github.repository == 'linode/linode_api4-python' # Run even if integration tests fail and only on main repository | ||
| # Run even if integration tests fail on main repository AND push event OR test_report_upload is true in case of manual run | ||
| if: always() && github.repository == 'linode/linode_api4-python' && (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.test_report_upload == 'true')) |
There was a problem hiding this comment.
This if: condition is getting hard to read/maintain inline. Consider using a folded scalar (if: >-) to format it across multiple lines (same expression), or consolidating the event gating into a single clearly named expression to reduce future mistakes when extending supported triggers.
| if: always() && github.repository == 'linode/linode_api4-python' && (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.test_report_upload == 'true')) | |
| if: >- | |
| always() && | |
| github.repository == 'linode/linode_api4-python' && | |
| ( | |
| github.event_name == 'push' || | |
| (github.event_name == 'workflow_dispatch' && inputs.test_report_upload == 'true') | |
| ) |
| test_report_upload: | ||
| description: 'Indicates whether to upload the test report to object storage. Defaults to "false"' | ||
| required: false | ||
| default: 'false' | ||
| type: choice | ||
| options: | ||
| - 'true' | ||
| - 'false' |
There was a problem hiding this comment.
For workflow_dispatch inputs, using type: boolean (instead of a string choice of 'true'/'false') simplifies the conditionals (no string comparison) and better communicates intent to callers.
📝 Description
Added workflow logic to upload test results for manual runs on demand only