Repository navigation
Use setup-codeql logic for finding release assets in start-proxy
#4198
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
Open
mbg
wants to merge
22
commits into
main
Choose a base branch
from
mbg/start-proxy/deprecate-fallback
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+682
−438
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
909fda1
Allow logging functions to accept `string[]` directly
mbg cb7acf5
Refactor `getCodeQLActionRepository` out of `setup-codeql`
mbg 3f57a00
Use `ActionState` for `getCodeQLActionRepository`
mbg da07d40
Refactor `getCodeQLBundleDownloadURL` out of `setup-codeql`
mbg 35f12de
Add utility for assertions on sinon stubs with better output by default
mbg a4f9f6f
Type the `assetKind` parameter
mbg de99f0e
Add `getDefaultDotComDownloadURL`
mbg 133ffeb
Use `getCodeQLAssetDownloadURL` for `start-proxy`
mbg f9a9962
Fix `onceWith` not asserting the `once` part
mbg 265d882
Merge branch 'main' into mbg/start-proxy/deprecate-fallback
mbg c1b620c
Allow `initializeEnvironment` to accept `Env`
mbg ad8ebce
Add and use `RepositoryNwoStr` type
mbg 1a92e13
Use `GITHUB_DOTCOM_URL` in `getDefaultDotComDownloadURL`
mbg e93db40
Use "asset" in comment
mbg fdc069b
Use `DownloadSource` for `potentialDownloadSources`
mbg 06bd6e2
`DotCom` => `Dotcom`
mbg 3d7016f
Log more in `getProxyBinaryPath`
mbg dd3898a
Await `toolcache.downloadTool`
mbg ac44fd0
Remove duplicated assertions
mbg a1794a0
Fix `mockGetReleaseByTag` usage
mbg 8fed29e
Rename `apiURL` to `instanceURL`
mbg 5aa103d
Add `InstanceURL` and use in `DownloadSource`
mbg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import test from "ava"; | ||
|
|
||
| import { joinMessageStrings } from "./logging"; | ||
| import { setupTests } from "./testing-utils"; | ||
|
|
||
| setupTests(test); | ||
|
|
||
| test("joinMessageStrings", async (t) => { | ||
| // For strings and errors, it is the identity function. | ||
| t.deepEqual(joinMessageStrings("Hello"), "Hello"); | ||
|
|
||
| const error = new Error("Some error"); | ||
| t.deepEqual(joinMessageStrings(error), error); | ||
|
|
||
| // For arrays of strings, we get a join-ed string. | ||
| t.deepEqual(joinMessageStrings(["foo", "bar"]), "foo bar"); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import * as path from "path"; | ||
|
|
||
| import test from "ava"; | ||
| import * as sinon from "sinon"; | ||
|
|
||
| import * as actionsUtil from "../actions-util"; | ||
| import { ActionsEnvVars } from "../environment"; | ||
| import { callee, getTestEnv, setupTests } from "../testing-utils"; | ||
| import { initializeEnvironment } from "../util"; | ||
|
|
||
| import { getCodeQLActionRepository } from "./repository"; | ||
|
|
||
| setupTests(test); | ||
|
|
||
| test.serial("getCodeQLActionRepository", async (t) => { | ||
|
mbg marked this conversation as resolved.
|
||
| const initialEnv = getTestEnv({ | ||
| [ActionsEnvVars.RUNNER_TEMP]: path.dirname(__dirname), | ||
| }); | ||
| initializeEnvironment("1.2.3", initialEnv); | ||
|
|
||
| const target = callee(getCodeQLActionRepository) | ||
| .withArgs() | ||
| .withEnv(initialEnv); | ||
|
|
||
| // isRunningLocalAction() === true | ||
| await target.passes(t.deepEqual, "github/codeql-action"); | ||
|
|
||
| // isRunningLocalAction() === false | ||
| sinon.stub(actionsUtil, "isRunningLocalAction").returns(false); | ||
| await target | ||
| .withEnv((env) => { | ||
| env.set(ActionsEnvVars.GITHUB_ACTION_REPOSITORY, "xxx/yyy"); | ||
| }) | ||
| .passes(t.deepEqual, "xxx/yyy"); | ||
| }); | ||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking back at this after a commit-by-commit review, does anything use this? If not, let's remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used by other definitions in
logging.tsbelow (same commit that introduced the definition).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I mean to say that none of our source code passes an array to a logger. We can keep it if you feel strongly about it though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. I did have at least one place that used this when I added it but maybe that went away while I was working on this PR. In any case, I have come across the same need in some of my other work, so I do think this is a useful addition whether this PR makes use of it or not.