Add run pr
and download pr
to toolkit
#16770
Merged
+256
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the
toolkit run pr
andtoolkit download pr
commands totoolkit
. This is a more fleshed out version of the snippet shared in #16633, with robust error handling and cross-platform unzip support.When using
toolkit run pr
, the script will also check if the most recent binary for that PR has already been downloaded, and if so it will run that instead.I tried to make the error reporting as good as a built-in command to see how difficult that would be, and with use of the
--head: oneof<>
trick, it turned out pretty good. With access to the call span, the workflow is very similar to when writing a built-in command. I also used aSpanned
-like record, which helped as well.More error reporting notes
In an earlier version of the script, `run pr` called `download pr` directly. I ended up changing the way this worked so that `run pr` could use the workflow_id. Here's a couple snippets I thought were neat from this older version.Passing span via
--head
:Using "spanned" number as CLI parameter and as internal caller parameter
Release notes summary - What our users need to know
The toolkit in the Nushell repository can now download and run PRs by downloading artifacts from CI runs. It can be run like this: