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

[gha][binary sizes] Use the input context to read the toolchain_version #150

Merged
merged 1 commit into from
May 22, 2024

Conversation

kendalharland
Copy link
Member

@kendalharland kendalharland commented May 22, 2024

This workflow is failing to run when new swift toolchain releases are created because toolchain_version is resolved to the branch name ("main") after the initial context job, rather than the newly released swift toolchain version. The bug is in the callee (release-swift-toolchain-binary-sizes.yml) rather than the caller (workflow-run-release-swift-toolchain-binary-sizes.yml), which is correctly looking up and passing the toolchain version along in its workflow invocation.

This is happening because the callee reads the toolchain_version input using github.event.inputs which is empty if the caller is triggered by a workflow_run event which has no inputs: The caller's github.event.inputs is always forwarded to the callee for workflow_run event triggers.

This was not caught during testing because in presubmit we trigger the caller using pull_request rather than workflow_run, and we look for a hard-coded test toolchain version since no latest version is available. This change switches the callee to use the input context which always has the correct value regardless of whether the triggering event is workflow_call (whereby we inherit github.event from the caller) or workflow_dispatch (whereby the inputs are passed directly to the workflow by the user).

Previously this workflow read the toolchain_version input using
`github.event.inputs` which carries the same `event` values as the calling
workflow This means `github.event.inputs` is empty when the workflow is
triggered via workflow_call and the calling worfklow was triggered as part of
a `schedule` event. This was not caught during testing because we triggered
the calling worfklow using the `pull_request` event instead. This change
switches to using the `input` context which is always set to the correct
value regardless if whether our workflow is triggered via
`pull_request`, `workflow_call` or `workflow_dispatch`.
@kendalharland kendalharland requested a review from compnerd May 22, 2024 17:41
@kendalharland kendalharland merged commit 582aae3 into main May 22, 2024
4 checks passed
@kendalharland kendalharland deleted the kendal/fix-input-toolchain-version branch May 22, 2024 17:53
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.

2 participants